52 lines
1.1 KiB
Bash
Executable File
52 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
### BEGIN INIT INFO
|
|
# Provides: vn-updater
|
|
# Required-Start: $network $remote_fs
|
|
# Required-Stop: $network $remote_fs
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: The updater service
|
|
# Description: Enable service provided by daemon.
|
|
### END INIT INFO
|
|
|
|
DESC="Verdnatura updater"
|
|
NAME=vn-updater
|
|
DAEMON=/usr/sbin/vn-updater
|
|
PIDFILE=/var/run/$NAME.pid
|
|
OPTS="--quiet --pidfile $PIDFILE --name $NAME"
|
|
START_OPTS="-S $OPTS --oknodo --make-pidfile --background --exec $DAEMON"
|
|
STOP_OPTS="-K $OPTS --retry=TERM/30/KILL/5"
|
|
|
|
test -x $DAEMON || exit 0
|
|
|
|
. /lib/lsb/init-functions
|
|
|
|
case "$1" in
|
|
start)
|
|
log_daemon_msg "Starting $DESC" "$NAME"
|
|
start-stop-daemon $START_OPTS
|
|
log_end_msg $?
|
|
;;
|
|
stop)
|
|
log_daemon_msg "Stopping $DESC" "$NAME"
|
|
start-stop-daemon $STOP_OPTS
|
|
rm -f $PIDFILE
|
|
log_end_msg $?
|
|
;;
|
|
restart|force-reload)
|
|
$0 stop
|
|
sleep 1
|
|
$0 start
|
|
;;
|
|
status)
|
|
status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $?
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart|force-reload|status}"
|
|
exit 1
|
|
esac
|
|
|
|
exit 0
|
|
|