Its not a cron entry. I'm running the script from the command line. The same script creates the files and executes the FTP.
Code:
#!/usr/bin/ksh
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
function hcistats_main {
# Setup the logfile and error file
logfile="$HCIROOT/archiveqdx/hcistats.$today.log"
errfile="$HCIROOT/archiveqdx/hcistats.$today.err.log"
# Initialize total messages processed on this server
hosttotal=0
# If a date is supplied, collect stats for that date
if [[ -n $1 ]]
then
collectdate=$1
fi
# setup daily stat collection files
thcollectfile="$HCIROOT/archiveqdx/hcistats.thcollect.$collectdate.csv"
prcollectfile="$HCIROOT/archiveqdx/hcistats.prcollect.$collectdate.csv"
stcollectfile="$HCIROOT/archiveqdx/hcistats.stcollect.$collectdate.csv"
svcollectfile="$HCIROOT/archiveqdx/hcistats.svcollect.$collectdate.csv"
# setup daily info update files
thupdatefile="$HCIROOT/archiveqdx/hcistats.thupdate.$collectdate.csv"
prupdatefile="$HCIROOT/archiveqdx/hcistats.prupdate.$collectdate.csv"
stupdatefile="$HCIROOT/archiveqdx/hcistats.stupdate.$collectdate.csv"
svupdatefile="$HCIROOT/archiveqdx/hcistats.svupdate.$collectdate.csv"
echo "\n------------------------- hcistats initiated $today -------------------------" >> $errfile
rm $thcollectfile $prcollectfile $stcollectfile $svcollectfile $thupdatefile >> $logfile 2>> $errfile
# If a site argument is supplied just run for that site.
if [[ -n $2 ]]
then
mysites=$2
else
# get a list of sites
mysites=`cat $HCIROOT/prodsites`
fi
echo "--------------------------- Run date: $today -------------------------" >> $logfile
echo "------------------------- Stats Date: $collectdate -------------------------" >> $logfile
# Get name of server I'm running on
myhost=`hostname`
echo "----------------------------- Server: $myhost -------------------------" >> $logfile
echo "User specified sites:\n$mysites" >> $logfile
for mysite in $mysites
do
# Setup Cloverleaf environment variables and hci commands
setroot
setsite $mysite
# Verify the setsite command was successful
sitecheck=`showroot | grep "HCI site" | awk '{print $4}'`
if [[ $sitecheck == $mysite ]]
then
# If the site directory exists in archives, get stats
mysitedir=$HCIROOT/archiveqdx/$mysite
if [[ -d $mysitedir ]]
then
echo "\n------------------------- Site: $mysite -------------------------" >> $logfile
sitetotal=`hcistats_site $myhost $mysite`
hosttotal=$(( $hosttotal + $sitetotal ))
else
echo "ERROR - Archive directory \"$mysitedir\" not found. Skipping site $mysite." >> $errfile
fi
else
echo "ERROR - Setsite Command failed for $mysite. Skipping site $mysite." >> $errfile
fi
done
echo "Total messages for server $myhost: $hosttotal" >> $logfile
echo "--------------------------------------------------------------------------------" >> $logfile
ftp -n <<WHATEVER
open 10.101.26.218
user hcistats *******
ascii
put $thupdatefile
put $thcollectfile
quit
WHATEVER
}
Hello All.
I am having a directory /tmp/rahul which contains many files in the format
@#home@#rahul@#programs@#script.pl
where /home/rahul/programs is the directory where the script.pl file is to be placed.
I have many files in this format.
What i want is a script which read these... (7 Replies)
Dear all
We are currently working on to install some ERP system in wjhich we
need to FTP from unix to windows 2000 machine
We run ./lodrun to get files from d/xxxxx/xxxx directory but the ftpoutput.log file shows following error
FTP: xxxxxxxxx system cannot find the path specified... (1 Reply)
I am using shell script to do secure ftp. I have done key file setup to do password less authentication. Following are the FTP Details:
FTP Client has Sun SSH.
FTP Server has F-Secure.
I am using SCP Command to do secure copy files. When I am doing this, I am getting the foll error
scp:... (2 Replies)
Hi experts,
I have a simple shell script as follows.
#!/bin/ksh
FIND_STRING="\( -name 'testfile*.Z' -o -name 'DUMMY_*' \) "
find /tmp -type f $FIND_STRING -print
When I run this with ksh -x testscript, I get the following output.
+ FIND_STRING=\( -name 'testfile*.Z' -o -name... (6 Replies)
What is the command to find the path of a file if we know the file name and the root directory where the file resides..
For eg. if a file abc.dat resides in /home/mydir/myfiles/. I am looking for a command which will be fired from / directory, takes abc.dat as input and display the path of... (3 Replies)
i understand by using the pwd command we get the present working directory.
which command is used to find absolute path from home directory to root..
What is absolute path to your and root user's home directory.:confused::confused::confused: (2 Replies)
-----Edit-----
My original post was long and confusing. To sum it up, I am wondering how to do the following Debian based commands on an RPM type system.
dpkg -i XXX.deb
update-initramfs -k xxx -c
update-grub
I hope someone can provide some insight. Thanks in advance!
--------------... (0 Replies)
Hi!
I made a shell script which is offering menu choice. I made it on RHEL & then with little bit changes I was able to run successfully on AIX/ksh.
Script is working fine with no issues other than a little one i.e., There is one choice in which I can list out and delete some files from a... (10 Replies)
Hi
cannot find the path to a running process on a host.
I looked and tried some suggestions in forums to no avail.
can someone please help? I need to know where this process is starting from as we have several versions in multiple directories
--------- Process name
1201 1 0 Feb 14 ?... (14 Replies)
Hi guys. I want to know the path of a command. I tried "which" command also . But no luck.
Please tell me how to find and update the correct path of the command.
Here I'm unable to find the path of ext2online command
# resize2fs /dev/vg01/lvora_backup
resize2fs 1.39 (29-May-2006)... (3 Replies)
Discussion started by: vamshigvk475
3 Replies
LEARN ABOUT LINUX
logsave
LOGSAVE(8) System Manager's Manual LOGSAVE(8)NAME
logsave - save the output of a command in a logfile
SYNOPSIS
logsave [ -asv ] logfile cmd_prog [ ... ]
DESCRIPTION
The logsave program will execute cmd_prog with the specified argument(s), and save a copy of its output to logfile. If the containing
directory for logfile does not exist, logsave will accumulate the output in memory until it can be written out. A copy of the output will
also be written to standard output.
If cmd_prog is a single hyphen ('-'), then instead of executing a program, logsave will take its input from standard input and save it in
logfile
logsave is useful for saving the output of initial boot scripts until the /var partition is mounted, so the output can be written to
/var/log.
OPTIONS -a This option will cause the output to be appended to logfile, instead of replacing its current contents.
-s This option will cause logsave to skip writing to the log file text which is bracketed with a control-A (ASCII 001 or Start of
Header) and control-B (ASCII 002 or Start of Text). This allows progress bar information to be visible to the user on the console,
while not being written to the log file.
-v This option will make logsave to be more verbose in its output to the user.
AUTHOR
Theodore Ts'o (tytso@mit.edu)
SEE ALSO fsck(8)E2fsprogs version 1.41.14 December 2010 LOGSAVE(8)