47 lines
907 B
Bash
47 lines
907 B
Bash
#!/bin/sh
|
|
|
|
if [ $# -eq 1 ]
|
|
then
|
|
else
|
|
echo "Usage : sh_statusd [start | stop]"
|
|
exit 0
|
|
fi
|
|
|
|
user=`whoami`
|
|
if [ $user = root ]
|
|
then
|
|
else
|
|
echo "access denied!!"
|
|
exit 0
|
|
fi
|
|
|
|
case $1 in
|
|
start)
|
|
sh_id=`ps -aux | grep new_sh_statusd | awk '/guard\(report\)/ {print $2}'`
|
|
proc_id=`find /proc/$sh_id | grep file | awk -F/ '{print $3}'`
|
|
if [ "$sh_id" = "$proc_id" ]
|
|
then
|
|
echo "sh_statusd(pid=$sh_id) already running"
|
|
else
|
|
echo "/user/service/bin/new_sh_statusd"
|
|
fi ;;
|
|
stop)
|
|
sh_id=`ps -aux | grep new_sh_statusd | awk '/guard\(report\)/ {print $2}'`
|
|
proc_id=`find /proc/$sh_id | grep file | awk -F/ '{print $3}'`
|
|
if [ "$sh_id" = "$proc_id" ]
|
|
then
|
|
killall -9 new_sh_statusd
|
|
sleep 1
|
|
pkill new_sh_statusd
|
|
pkill new_sh_statusd
|
|
sleep 1
|
|
pkill new_sh_statusd
|
|
else
|
|
echo "sh_statusd not running"
|
|
fi ;;
|
|
*)
|
|
echo "Unkown Argument '$1'"
|
|
echo "Usage : sh_statusd [start | stop]"
|
|
esac
|
|
exit 1
|