hallo,
Because if i execute many session of the same shell script cause some bugs,
i would like to add some kind of verification in the head of that script, in order to forbid the user to execute another session of the same script, and exit with a message like "there is another session of the script on execution, close it before continuing!!"
How to do that ?
i guess that i have to use the ps command but how?
i tried that but doesn't work
*********************************
instance=`ps -A | grep reply_daemon | awk '{print $1}'`
if [ "${instance}" != "$$" ]
then
echo "Another instance of the script <script_daemon> is running, close it !"
exit 1
fi
**************************************
by adding that, i can never execute any session of the script ....
thanks!