#!/bin/sh
if [ -f $0.lock ]; then
(ps -e | grep $$) >> $0.lock
if [ "$(cat $0.lock | wc -l)" -gt 1 ];then
echo "\"$0\" is already running with PID=`awk '{print $1}' $0.lock | head -1` !!"
exit 0
fi
else
(ps -e | grep $$) > $0.lock
tn <ServerName>
rm $0.lock
fi
if [ -f $0.lock ]; then
(ps -e | grep $$) >> $0.lock
if [ "$(cat $0.lock | wc -l)" -gt 1 ];then
echo "\"$0\" is already running with PID=`awk '{print $1}' $0.lock | head -1` !!"
exit 0
fi
else
(ps -e | grep $$) > $0.lock
tn <ServerName>
rm $0.lock
fi
No comments :
Post a Comment