From 2c8a383fa70653da93e02f04abf85d97cb8aa66e Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sun, 9 Oct 2022 13:17:25 -0400 Subject: [PATCH] add sysvinit init script provided by cheif36 this script is not maintained --- contrib/sysvinit/lokinet | 59 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 contrib/sysvinit/lokinet diff --git a/contrib/sysvinit/lokinet b/contrib/sysvinit/lokinet new file mode 100644 index 0000000000..ec70ba14ae --- /dev/null +++ b/contrib/sysvinit/lokinet @@ -0,0 +1,59 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: lokinet +# Required-Start: $syslog $local_fs $remote_fs $network +# Required-Stop: $syslog $local_fs $remote_fs $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: LokiNET: Anonymous Network layer thingydoo, client +### END INIT INFO + +. /lib/lsb/init-functions +prog=lokinet +PIDFILE=/var/run/$prog.pid +DESC="LokiNET: Anonymous Network layer thingydoo, client" +start() { + log_daemon_msg "Starting $DESC" "$prog" + if start-stop-daemon --start --quiet --oknodo --chuid lokinet:lokinet --background --make-pidfile --pidfile $PIDFILE --exec /usr/bin/$prog /var/lib/lokinet/lokinet.ini; then + log_end_msg 0 || true + else + log_end_msg 1 || true + fi +} + +stop() { + log_daemon_msg "Stopping $DESC" "$prog" + if start-stop-daemon --stop --quiet --oknodo --remove-pidfile --pidfile $PIDFILE --exec /usr/bin/$prog ; then + log_end_msg 0 || true + else + log_end_msg 1 || true + fi +} + +reload() { + log_daemon_msg "Reload $DESC" "$prog" + if pkill -SIGUSR1 $(cat $PIDFILE ) ; then + log_end_msg 0 || true + else + log_end_msg 1 || true + fi +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + force-reload) + force_reload + ;; + restart) + stop + start + ;; + *) + echo "Usage: $prog {start|stop|reload|restart}" + exit 2 +esac