Hi,

 

Should anyone find this useful or see an issue with this code, please let me 
know.

 

When running a service, I like to be able to check the status of that service, 
and so I have added the following to the /etc/init.d/red5.sh script.

 

;;

restart)

       $0 stop

       $0 start

;;

status)

       # status $PROG -p $PIDFILE

       netstat -anp | grep soffice | grep 8100 &> /dev/nul  && echo 
$"OpenOffice server is running" || echo $"OpenOffice server is not running"

       #ps aux | grep -f $PIDFILE &> /dev/nul  && echo $"$PROG is running" || 
echo $"$PROG is not running"

       start-stop-daemon --status --pidfile $PIDFILE

       RETVAL=$?

       [ $RETVAL -eq 0 ]  && echo $"$PROG is running" 

       [ $RETVAL -eq 1 ]  && echo $"$PROG is not running and the pid file 
exists" 

       [ $RETVAL -eq 3 ]  && echo $"$PROG is not running" 

       [ $RETVAL -eq 4 ]  && echo $"$PROG  - unable to determine status" 

;;

checkports)

       netstat -anp | grep soffice 

       netstat -anp | grep java 

;;

*)

       echo $"Usage: $0 {start|stop|restart|status|checkports}"

       RETVAL=1

 

1)      While I prefer using start-stop-daemon to check the status, the code 
“ps aux …” works just as well if you uncomment it.
#ps aux | grep -f $PIDFILE &> /dev/nul  && echo $"$PROG is running" || echo 
$"$PROG

2)      I also like to check what ports are being used when I am altering ports 
so I also added a “checkports” option.




 

Thanks,

 

George Kirkham

Reply via email to