The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-13-2005
kadishmj kadishmj is offline
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!
  #2 (permalink)  
Old 06-13-2005
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,230
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.
  #3 (permalink)  
Old 06-13-2005
kadishmj kadishmj is offline
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
  #4 (permalink)  
Old 06-14-2005
Just Ice's Avatar
Just Ice Just Ice is offline Forum Advisor  
Lights on, brain off.
  
 

Join Date: Mar 2005
Location: in front of my computer
Posts: 637
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
  #5 (permalink)  
Old 06-14-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,122
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:18 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0