![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| verify if a process exists (ps) | melanie_pfefer | Shell Programming and Scripting | 4 | 04-05-2008 05:34 PM |
| File exists with Permissions | Jose Miguel | Shell Programming and Scripting | 2 | 04-16-2007 01:07 PM |
| Directory exists | tez | UNIX for Dummies Questions & Answers | 3 | 08-11-2006 08:46 AM |
| Folder Exists | borncrazy | UNIX for Dummies Questions & Answers | 5 | 06-19-2004 02:48 AM |
| : /var/adm/utmp exists! | dangral | SUN Solaris | 2 | 02-27-2004 11:17 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
process already exists
I'm attempting to modify a script that ftps files from one machine to another (see this post ). I've been testing it a few times, and once I had to kill the test because it was taking forever, and I know it wasn't working. Now, when I try to test the script again, I'm getting the following:
$ ./move_logs_test3.sh ./move_logs_test3.sh[18]: process already exists As a result, I can't test my script. -How do I determine what this process is? -How do I remove it? -How do I prevent this from happeneing again? Thanks for your help! |
|
||||
|
process already exists
My code is below. If the ftp co-process is still running, how would I end it?
Code:
#! /usr/bin/ksh
HOST=hostname
USER=user1
PASSWD=password
#logdir="/opt/system_logs"
logdir="/export/home/user1"
exec 4>&1
ftp -nv >&4 2>&4 |&
for SERVER in server1 server2 server3
do
cd $logdir/$SERVER
for FILENAME in `find . -type f -name "access_log*" -mtime 0 -print | sed 's/^\.\///'`
do
exec 4>&1
ftp -nv >&4 2>&4 |&
print -p open $HOST
print -p user $USER $PASSWD
print -p lcd $logdir/$SERVER
print -p cd $SERVER
print -p bin
print -p put $FILENAME
print -p bye
wait
exit 0
done
done
|
|
|||||
|
Also note that "exit 0" causes the script to terminate. Placed inside the loop like that, you will end the script on the first iteration of the loop. Move "exit 0" to the end of the script. On the other hand, leave "wait" exactly where it is. The "wait" makes the script pause until the ftp co-process has exited.
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|