process control
From: Leiji Liu (leijiliu_at_nexrain.com)
Date: 07/30/03
- Next message: Leiji Liu: "test"
- Previous message: Suhas: "awk & shell variables"
- Next in thread: Alexis Huxley: "Re: process control"
- Reply: Alexis Huxley: "Re: process control"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 30 Jul 2003 21:57:47 GMT
Hi,
I have a piece of script which runs periodically from cron table. In order
to prevent the second copy of the same code from running simultaneously, I
have to "ps" the current status of memory and if there is one copy running,
the second will not start. A guru gave me following piece (on Solaris
system):
The script's name is "allrun.sh".
#!/bin/ksh
check=`ps -ef |grep "/bin/ksh /home/mycode/allrun.sh" | wc -l`
if [ $check = 2 ] ; then
process my programs
fi
Here is the question. Why should the $check be 2? Or should it be better
$check < 2? When I manually start "allrun.sh" (not from cron table) from
command line, the $check is 0. Can anybody give me some explanation?
Thanks a lot!
ll
- Next message: Leiji Liu: "test"
- Previous message: Suhas: "awk & shell variables"
- Next in thread: Alexis Huxley: "Re: process control"
- Reply: Alexis Huxley: "Re: process control"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|