#!/bin/bash # script to start|stop|status of the monitor service (monitor.sh) pid=`ps -ef | grep "monitor.sh" | grep "/bin/bash" | grep -v grep | awk {'print $2'}` case "$1" in start) if [ $pid ] then echo "monitor service is already running: pid $pid" else echo "Starting monitor service...." ${HOME}/bin/portal/monitor.sh& fi ;; stop) if [ $pid ] then echo "killing: $pid" kill $pid else echo "monitor service not running" fi ;; status) if [ $pid ] then echo "monitor service is running: $pid" else echo "monitor service not running" fi ;; *) echo "Usage: $0 [start|stop|status]" exit 0 ;; esac exit $RETVAL