Sponsored Content
Top Forums Shell Programming and Scripting Problem with embedded FTP command in Ksh - System Cannot find the specified path. Post 302373462 by troym72 on Friday 20th of November 2009 09:32:15 AM
Old 11-20-2009
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

}


Last edited by troym72; 11-20-2009 at 10:41 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Moving files by splitting the path embedded in the filename

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)
Discussion started by: rahulrathod
7 Replies

2. HP-UX

URGENT: UNIX FTP cannot find path error

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)
Discussion started by: minix
1 Replies

3. Solaris

Secure FTP Problem using Sun SSH on Client system F-Secure on Server system

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)
Discussion started by: ftpguy
2 Replies

4. UNIX for Advanced & Expert Users

find command from shell scipt (ksh) problem

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)
Discussion started by: kodermanna
6 Replies

5. UNIX for Dummies Questions & Answers

command to find the path of a file

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)
Discussion started by: abhilashnair
3 Replies

6. UNIX for Dummies Questions & Answers

command to find the absolute path

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)
Discussion started by: shaziafathima
2 Replies

7. UNIX for Dummies Questions & Answers

Compiling Kernel for an Embedded System

-----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)
Discussion started by: b4sakenxx
0 Replies

8. Shell Programming and Scripting

Problem with find command at ksh

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)
Discussion started by: sukhdip
10 Replies

9. Solaris

Find path of executable having problem

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)
Discussion started by: mnassiri
14 Replies

10. Red Hat

How to find the path of a command?

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
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)
All times are GMT -4. The time now is 01:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy