The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts 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 01:34 PM
File exists with Permissions Jose Miguel Shell Programming and Scripting 2 04-16-2007 09:07 AM
Directory exists tez UNIX for Dummies Questions & Answers 3 08-11-2006 04:46 AM
Folder Exists borncrazy UNIX for Dummies Questions & Answers 5 06-18-2004 10:48 PM
: /var/adm/utmp exists! dangral SUN Solaris 2 02-27-2004 08:17 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-13-2005
Registered User
 

Join Date: Feb 2005
Posts: 11
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!
Reply With Quote
Forum Sponsor
  #2  
Old 06-13-2005
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,644
Post the script exactly as you have it. The line number does not tally with the script you referenced. It is most likely that your ftp co-proccess is still running.
Reply With Quote
  #3  
Old 06-13-2005
Registered User
 

Join Date: Feb 2005
Posts: 11
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
Reply With Quote
  #4  
Old 06-13-2005
Just Ice's Avatar
Lights on, brain off.
 

Join Date: Mar 2005
Location: in front of my computer
Posts: 629
try running the script without the red lines ... if that doesn't work still, make sure your find command gives you a definite list and doesn't go into an infinite loop ...

... if you have to kill the process --- look for ftp and/or find as that's where it's most likely to hang ...

Quote:
Originally Posted by kadishmj
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
Reply With Quote
  #5  
Old 06-14-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
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.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:24 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0