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
echo(1B)					     SunOS/BSD Compatibility Package Commands						  echo(1B)

NAME
echo - echo arguments to standard output SYNOPSIS
/usr/ucb/echo [-n] [argument] DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output. echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi- ronment variables. For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows: o echo your current-working-directory's full pathname o pipe the output through tr to translate the path's embedded slash-characters into space-characters o pipe that output through wc -w for a count of the names in your path. example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w" See tr(1) and wc(1) for their functionality. The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's echo() also understands a as the audible bell character; however, these commands do not have an -n option. OPTIONS
-n Do not add the NEWLINE to the output. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5) NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases. SunOS 5.10 3 Aug 1994 echo(1B)
All times are GMT -4. The time now is 01:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy