mirror of
https://github.com/miky-kr5/Robotd.git
synced 2023-01-29 18:47:06 +00:00
Added shutdown daemon
This commit is contained in:
57
shtdd.sh
Executable file
57
shtdd.sh
Executable file
@@ -0,0 +1,57 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: shtd
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Shutdown daemon.
|
||||
### END INIT INFO
|
||||
|
||||
start() {
|
||||
if pidof shtdd > /dev/null
|
||||
then
|
||||
echo "shtdd already started."
|
||||
return
|
||||
else
|
||||
echo "Starting shtdd"
|
||||
shtdd
|
||||
echo "Done."
|
||||
fi
|
||||
}
|
||||
|
||||
stop() {
|
||||
if pidof shtdd > /dev/null
|
||||
then
|
||||
echo "Stopping shtdd"
|
||||
kill -s INT `pidof shtdd`
|
||||
echo "Done."
|
||||
else
|
||||
echo "shtdd already stopped."
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|restart|force-reload)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
if pidof shtdd > /dev/null
|
||||
then
|
||||
echo "shtdd is running."
|
||||
else
|
||||
echo "shtdd is down."
|
||||
fi
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: {start|stop|restart|force-reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user