Need to stop script for until present command excuted


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to stop script for until present command excuted
# 1  
Old 09-22-2011
Need to stop script for until present command excuted

Hi,

Basically I am running a script in another script.

Code:
#!/bin/sh
DIRECTORY="/export/home/scripts"
CURDATIME=`date '+%m%d%y_%H%M%S'`
LOG_FILE="${DIRECTORY}/${CURDATIME}_abc.out"

echo "ABC Delta Script started at `${CURDATIME}`" > $LOG_FILE
cd ${DIRECTORY}
sh ./abcDeltaRun.sh  >> $LOG_FILE
echo "ABC Delta Script Ended at `${CURDATIME}`" >> $LOG_FILE

abcDeltaRun.sh will take approximately 2 days.
But it going to the next step immediately after the initiating the script.
When I look for the pid for that script is shows it is running.

Can you help me how to stop to go to next step after the abc script has initiated.
I want to check if the that pid is running every one hr and if it is there check after 1 hr otherwise continue with the next steps.

Regards
Rao

Last edited by pludi; 09-22-2011 at 05:49 PM..
# 2  
Old 09-22-2011
abcDeltaRun.sh must be forking and daemonizing itself.

I suppose you could

Code:
while ps aux | grep abcDeltaRun
do
        sleep 60
done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

UNIX command to ignore replacing a search string if it is already present

Hello, I am searching the following string Folder^ in a file and replacing it with Folder^/ However if the file already contains Folder^/ I want to avoid replacing it with Folder^// To do this I have to do the following today: 1) echo "Folder^" | sed 's/Folder\^/Folder\^\//g' I get... (2 Replies)
Discussion started by: mehimadri12
2 Replies

2. Shell Programming and Scripting

How to execute command present config file?

I have written the following shell script #!/bin/bash file="/home/CSV/data.csv" badfile="/home/CSV/bad/" while IFS= read -r line do num_fields=`echo "$line" | awk -F'|' '{print NF}'` field1=`echo "$line" | awk -F'|' '{print $1}'` echo $num_fields echo $field1 done <"$file" the code is... (3 Replies)
Discussion started by: Tomar
3 Replies

3. Shell Programming and Scripting

calling a shell script present on another server using perl script.

Hi, I am working on a sever A. I want to write a perl script to execute a shell script persent on the server B. please help me in this. thanks in advance. (3 Replies)
Discussion started by: anandgodse
3 Replies

4. Shell Programming and Scripting

Command to stop all the cron jobs

Hi All, Please provide the command to stop all the cron jobs. Thanks in Advance Regards, Sindu (2 Replies)
Discussion started by: indira_s
2 Replies

5. Shell Programming and Scripting

Best way to schedule a task that is be excuted years later

What is the best way to schedule a task that is be executed years later? Like execute a script after 4 years. Is cron the best method for that? Any other option other than cron/at ? :confused: (7 Replies)
Discussion started by: nitin09
7 Replies

6. Shell Programming and Scripting

Help with script to stop a user giving kill command on a server!!

Hi, I am new to shell scripting and want to create a script with the follwoing description: I want to restrict the users from giving a kill command on a unix server. The server have a restricted logins with login id and passwords. I want a script that will find out if a user has given a... (9 Replies)
Discussion started by: shell_scripting
9 Replies

7. Shell Programming and Scripting

Script to run a command on all txt files present in a dir structure

Hi, I have a directory structure like the one given below root\a\b1 root\a\b2 root\b\b1 root\b\b2 . . . root\j\b1 root\j\b2 Now, there are a txt files in each dir and subdir, there is a root.txt I have to write a script where in i have to run a command called "genrb <filename>"... (6 Replies)
Discussion started by: vikramsinghnegi
6 Replies

8. UNIX for Advanced & Expert Users

Executing a shell script from windows;script present in unix

I need to execute a shell script kept in unix machine from windows. User id, password area available. For eg. There's a shell script wich moves all the logs kept in my home directory to a directory named LOGS. Now i need to get this done through windows; either using a batch file, or java... (4 Replies)
Discussion started by: rajneesh_kapoor
4 Replies

9. Programming

Stop exe from command line

Hi All, I want to find if a certain exe is running and if it is running i want to stop the execution of this exe (the exe has been created by me) on solaris. What are the unix command i need to use and can i put these comand in a shell script or create a new exe to do this task (i would... (4 Replies)
Discussion started by: zing
4 Replies

10. Shell Programming and Scripting

Retrive the value returned by a command excuted in a remote server using ssh

Hello Everybody, I'm facing a weird problem with the awk command. I try to retrieve in a variable the value returned by a simple ls command. ls /export/home/tmp |tail -1 return a good value (the name of the . But When I try to execute the same command in a remote server using ssh as... (2 Replies)
Discussion started by: Jabarod
2 Replies
Login or Register to Ask a Question