process already exists


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting process already exists
# 1  
Old 06-13-2005
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. Smilie

-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  
Old 06-13-2005
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  
Old 06-13-2005
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  
Old 06-14-2005
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  
Old 06-14-2005
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

File exists or not

Dear All, I am facing a small issue in my code where in I am searching for a file in a directory and if found it sends me a message along with the time and filename. However if a file is not found based on the search pattern, the result which I am getting is all the files present in that... (7 Replies)
Discussion started by: grvk101
7 Replies

2. Shell Programming and Scripting

Command to get exact tomcat process I am running ignoring other java process

Team, I have multiple batchjobs running in VM, if I do ps -ef |grep java or tomcat I am getting multiple process list. How do I get my exact tomcat process running and that is unique? via shell script? (4 Replies)
Discussion started by: Ghanshyam Ratho
4 Replies

3. Shell Programming and Scripting

Monitoring processes in parallel and process log file after process exits

I am writing a script to kick off a process to gather logs on multiple nodes in parallel using "&". These processes create individual log files. Which I would like to filter and convert in CSV format after they are complete. I am facing following issues: 1. Monitor all Processes parallelly.... (5 Replies)
Discussion started by: shunya
5 Replies

4. Shell Programming and Scripting

File exists, but cannot be opened.How to check- whether it could be opened to read when it exists

Hi #Testing for file existence if ; then echo 'SCHOOL data is available for processing' else echo 'SCHOOL DATA IS NOT AVAILABLE FOR PROCESSING' : i wrote a script, where it begins by checking if file exists or not. If it exists, it truncates the database... (2 Replies)
Discussion started by: rxg
2 Replies

5. Shell Programming and Scripting

Script to delete a process if it exists

I have an application that uses java but when the application stops, sometimes, for some odd reason, it leaves java threads behind. When the application next starts, it doesn't behave properly because of these previous java processes What I want to do is create a script to check for these java... (2 Replies)
Discussion started by: davidra
2 Replies

6. Shell Programming and Scripting

script to monitor the process system when a process from user takes longer than 15 min run.

get email notification from from system when a process from XXXX user takes longer than 15 min run.Let me know the time estimation for the same. hi ,any one please tell me , how to write a script to get email notification from system when a process from as mentioned above a xxxx user takes... (1 Reply)
Discussion started by: kirankrishna3
1 Replies

7. Shell Programming and Scripting

Shell Script to Kill Process(number of process) Unix/Solaris

Hi Experts, we do have a shell script for Unix Solaris, which will kill all the process manullay, it used to work in my previous env, but now it is throwing this error.. could some one please help me to resolve it This is how we execute the script (and this is the requirement) ... (2 Replies)
Discussion started by: jonnyvic
2 Replies

8. Shell Programming and Scripting

script to monitor process running on server and posting a mail if any process is dead

Hello all, I would be happy if any one could help me with a shell script that would determine all the processes running on a Unix server and post a mail if any of the process is not running or aborted. Thanks in advance Regards, pradeep kulkarni. :mad: (13 Replies)
Discussion started by: pradeepmacha
13 Replies

9. Shell Programming and Scripting

verify if a process exists (ps)

hi I want to verify that a process exists. if the process exists, then it means the service is up. ps -ef | grep monito returns an entry if the service is up. how to translate that in a shell script?? many thanks (4 Replies)
Discussion started by: melanie_pfefer
4 Replies

10. UNIX for Dummies Questions & Answers

Directory exists

Hi all, Sorry about this i'm sure this is a very silly question hence an easy answer but: I'm trying to write a script, part of which I want to check if a directory exists, if it doesn't then create it. Thanks for your help Tez (3 Replies)
Discussion started by: tez
3 Replies
Login or Register to Ask a Question