1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +00:00

Prototype init script

It should work, but testing it is not altogether obvious
This commit is contained in:
J. King 2021-06-30 17:59:15 -04:00
parent e160189224
commit 8a1a1eee42

64
dist/init.sh vendored
View file

@ -12,6 +12,66 @@
# Description: The Arsse is a multi-protocol Web newsfeed synchronization service
### END INIT INFO
NAME=arsse
DAEMON=/usr/bin/arsse
# This script is designed for Debian; some adaptation will be required for other systems
NAME=arsse
DESC=newsfeed synchronization server
PIDFILE=/run/arsse.pid
DAEMON=/usr/bin/$NAME
. /lib/init/vars.sh
. /lib/lsb/init-functions
arsse_start() {
touch "$PIDFILE"
chown arsse:arsse "$PIDFILE"
$DAEMON daemon --fork "$PIDFILE" || return 2
}
arsse_stop() {
killproc -p "$PIDFILE" "$DAEMON"
}
arsse_reload() {
killproc -p "$PIDFILE" "$DAEMON" HUP
}
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
if pidofproc -p $PIDFILE "$DAEMON" > /dev/null 2>&1 ; then
return 1
fi
arsse_start
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
arsse_stop
;;
restart)
log_daemon_msg "Restarting $DESC" "$NAME"
if pidofproc -p $PIDFILE "$DAEMON" > /dev/null 2>&1 ; then
arsse_stop
fi
arsse_start
;;
try-restart)
if pidofproc -p $PIDFILE "$DAEMON" > /dev/null 2>&1 ; then
log_daemon_msg "Restarting $DESC" "$NAME"
arsse_stop
arsse_start
fi
;;
reload|force-reload)
log_daemon_msg "Reloading $DESC" "$NAME"
arsse_reload
;;
status)
status_of_proc -p $PIDFILE $DAEMON $NAME
exit $?
;;
*)
echo "Usage: $0 {start|stop|restart|try-restart|reload|status}" >&2
exit 3
;;
esac