Dieser Dienst geht mit service dienstname start/stop:
Code: Alles auswählen
#!/bin/sh
# description: Start or stop the watchinsect
# Added by XYZ
### BEGIN INIT INFO
# Provides: watchinsect
# Required-Start: $ALL
# Required-Stop: $local_fs $remote_fs
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: WATCHINSECT server
### END INIT INFO
set -e
cd /opt/XYZ
case "$1" in
'start')
echo "Starting XYZ watching ..."
perl watchinsect.pl
RETVAL=$?
;;
'stop')
echo "Stopping XYZ watching ..."
pkill -U root perl
RETVAL=$?
;;
'state')
cnt=`ps -ef | grep "watchinsect.pl" | grep -v grep | wc -l`
if [ "$cnt" -eq "0" ] ; then
echo "XYZ watching is not running"
else
echo "XYZ watching is running"
fi
;;
*)
echo "Usage: $0 { start | stop | state }"
RETVAL=1
;;
esac
exit $RETVAL
Dieser nicht:
Code: Alles auswählen
#!/bin/sh
# description: Start or stop the XYZ state server
### BEGIN INIT INFO
# Provides: XYZ
# Required-Start: $ALL
# Required-Stop: $local_fs $remote_fs $XYZ_devstate $practisync
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: XYZ server
### END INIT INFO
set -e
cd /opt/XYZ
case "$1" in
'start')
cnt=`ps -ef | grep "XYZ_master" | grep -v grep | wc -l`
if [ "$cnt" -eq "0" ] ; then
echo "starting XYZ service..."
./XYZ_master
else
echo "XYZ is already started..."
fi
RETVAL=$?
;;
'stop')
echo "Stopping XYZ service..."
killall XYZ_master
cnt1=`ps -ef | grep "XYZ_master" | grep -v grep | wc -l`
if [ "$cnt1" -eq "0" ] ; then
echo "XYZ is stopped"
else
killall -9 XYZ_master
echo "XYZ is stopped (-9)"
fi
RETVAL=$?
;;
'restart')
echo "Stopping XYZ service..."
cnt2=`ps -ef | grep "XYZ_master" | grep -v grep | wc -l`
if [ "$cnt2" -eq "0" ] ; then
echo "XYZ is stopped"
else
killall XYZ_master
cnt3=`ps -ef | grep "XYZ_master" | grep -v grep | wc -l`
if [ "$cnt3" -eq "0" ] ; then
echo "XYZ is stopped"
else
killall -9 XYZ_master
echo "XYZ is stopped (-9)"
fi
fi
echo "Starting XYZ service..."
./XYZ_master
RETVAL=$?
;;
'restart_noscan')
echo "Stopping XYZ service..."
cnt2=`ps -ef | grep "XYZ_master" | grep -v grep | wc -l`
if [ "$cnt2" -eq "0" ] ; then
echo "XYZ is stopped"
else
killall XYZ_master
cnt3=`ps -ef | grep "XYZ_master" | grep -v grep | wc -l`
if [ "$cnt3" -eq "0" ] ; then
echo "XYZ is stopped"
else
killall -9 XYZ_master
echo "XYZ is stopped (-9)"
fi
fi
echo "Starting XYZ service..."
./XYZ_master -o
RETVAL=$?
;;
'state')
cnt=`ps -ef | grep "XYZ_master" | grep -v grep | wc -l`
if [ "$cnt" -eq "0" ] ; then
echo "XYZ is not running"
else
echo "XYZ is running"
fi
;;
*)
echo "Usage: $0 { start | stop | state }"
RETVAL=1
;;
esac
exit $RETVAL
...ich frage mich, wo da wohl der Unterschied liegt?