Killing process!!!!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Killing process!!!!
# 1  
Old 02-03-2009
Data Killing process!!!!

Hi friends,

i m in big trouble....

i have one script which connects two server ...like below..

script1.sh
-------------------------------------
bash test.sh &
eval x=$@
export x=`echo $x`
#echo $x
#
ssh user@8.2.5.6 bash /mbbv/location/script.sh $x|sed '/Binary file/d'
----------------------------------------------

here first one which is "bash test.sh &"
i want this to be run in backend...purpose is to check whether the entire script is taking much time or not...if its taking more than 1 min then test.sh will kill the current process and will return message "saying that process is delayed"

i have given code for test.sh also..
---------------------------------------------------
pid=`ps -ef |grep "script.sh"|awk '{print $2}'|tail -2|head -1`
sleep 60
ps -ef |awk '{print $2}'|grep $pid >/dev/null
if [ $? -eq 0 ]
then
kill -9 $pid > /dev/null
echo "Server seems to be busy. Please try after some time. Sorry for the inconvenience"
fi
exit 1;
---------------------------------------------------------
my problem:

i have one jsp tool which will trigger the first script and will display whatever comes from unix script(script1.sh)...but when i run this script with this condition(60 sec process time) ...its not considering the test.sh script..instead its running and doing all the process with more than 1 mint..

but if i checked the same thing without jsp tool ...if i run manually like below..

bash script.sh 444444444
then its returning the correct message ..

can anyone help me on this please.....

Thanks
sha
# 2  
Old 02-06-2009
This limit program might help you a bit. It runs the specified command but kills it after a specified number of seconds. Might solve your entire problem.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Killing the process ID's

Hi , I have a list of application process id's. Is there a way to kill all the process listed below using the script, except the once which are starting with " Genesis " adm 1522 ABC_Process.tra adm 1939 Genesis_Process.tra adm 2729 Genesis_Archive.tra adm 3259 xyz_Process.tra (5 Replies)
Discussion started by: murali1687
5 Replies

2. UNIX for Advanced & Expert Users

Killing A Stopped Process

UNIX Tutorial Five % kill %jobnumber Does that not work on a stopped process? I've tried to kill a stopped process and it is not working. Or do you need a certain type of shell for this to work? I don't see anything about this in my man pages. (3 Replies)
Discussion started by: cokedude
3 Replies

3. Shell Programming and Scripting

Finding the age of a unix process, killing old processes, killing zombie processes

I had issues with processes locking up. This script checks for processes and kills them if they are older than a certain time. Its uses some functions you'll need to define or remove, like slog() which I use for logging, and is_running() which checks if this script is already running so you can... (0 Replies)
Discussion started by: sukerman
0 Replies

4. Shell Programming and Scripting

Killing process and children

Hi all, I have been searching all day for a nice solution to this problem. I have three scripts. A start script, a child script and a stop script. Script A (scripta.sh) Its Child Script B (scriptb.sh) Script C (kill_process.sh $PID) Script A correctly traps the kill command sent from... (6 Replies)
Discussion started by: mark007
6 Replies

5. UNIX for Dummies Questions & Answers

killing the process

Hi, First, I am running a scipt.While the script is running I realize that I dont want the script to be run so I am killing the script externally.Before the process gets terminated or killed it should delete all the temporary files created by the script.How to do this?Can anyone help me? ... (3 Replies)
Discussion started by: arthi
3 Replies

6. Shell Programming and Scripting

Killing of a process and send a mail if the process doesnot come up within 2 minutes

Hi Friends, I am new to this forum as well as new to shell scripting. I have a problem here and i need someone to solve this. Let us consider there are two processes(abc & def).There is a script which kills these two processes(i.e killtheprocess abc). Here abc is the argument . There is a... (1 Reply)
Discussion started by: Prince89
1 Replies

7. UNIX for Dummies Questions & Answers

killing a process

I can kill running processes on my linux red hat system using ctrl-c but cannot do it from command line of another terminal using kill -2 pid. Although I can kill them from command line using kill -9 pid and other signals. I would like to do it using the kill -2 pid. Thanks for your suggestions (6 Replies)
Discussion started by: bbhayana
6 Replies

8. Shell Programming and Scripting

killing a child process

I am calling another script from my main script and making it run in the background,based upon the value of the input provided by the user I want to kill the child process ,I have written this code timer.ksh & PID=$$ print "\n Do you wish to continue .. (Y/N) : \c " read kill_proc if ]... (4 Replies)
Discussion started by: mervin2006
4 Replies

9. UNIX for Advanced & Expert Users

killing a process pid

What option is used with kill to cause the server to reread its config file. (16 Replies)
Discussion started by: jo calamine
16 Replies

10. AIX

killing a process from a script

Hey all. I'm brand new to this forum and am looking for some help. I have a script that verifies that the backup tapes are working correctly. Basically is uses 1 command: restore -xpqvf > rootvglog I use this for each volume group that we have. We run this everyday but the problem is, we... (4 Replies)
Discussion started by: jalge2
4 Replies
Login or Register to Ask a Question