mirror of
https://github.com/EDCD/EDDN.git
synced 2025-04-20 18:47:39 +03:00
54 lines
1.0 KiB
Bash
54 lines
1.0 KiB
Bash
#!/bin/sh
|
|
|
|
### BEGIN INIT INFO
|
|
# Provides: eddn-relay
|
|
# Required-Start: $network
|
|
# Required-Stop:
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
### END INIT INFO
|
|
|
|
NAME=eddn-relay
|
|
DESC="eddn-relay"
|
|
PIDFILE="/var/run/${NAME}.pid"
|
|
LOGFILE="/var/log/eddn/${NAME}.log"
|
|
|
|
DAEMON="/home/eddn/eddn/python-venv/bin/${NAME}"
|
|
|
|
EXEC_AS_USER="root"
|
|
|
|
START_OPTS="--start --background --make-pidfile --pidfile ${PIDFILE} --chuid ${EXEC_AS_USER} --exec ${DAEMON}"
|
|
STOP_OPTS="--stop --pidfile ${PIDFILE}"
|
|
|
|
test -x $DAEMON || exit 0
|
|
|
|
set -e
|
|
|
|
case "$1" in
|
|
start)
|
|
echo -n "Starting ${DESC}: "
|
|
start-stop-daemon $START_OPTS >> $LOGFILE
|
|
echo "$NAME."
|
|
;;
|
|
stop)
|
|
echo -n "Stopping $DESC: "
|
|
start-stop-daemon $STOP_OPTS
|
|
echo "$NAME."
|
|
rm -f $PIDFILE
|
|
;;
|
|
restart|force-reload)
|
|
echo -n "Restarting $DESC: "
|
|
start-stop-daemon $STOP_OPTS
|
|
sleep 1
|
|
start-stop-daemon $START_OPTS >> $LOGFILE
|
|
echo "$NAME."
|
|
;;
|
|
*)
|
|
N=/etc/init.d/$NAME
|
|
echo "Usage: $N {start|stop|restart|force-reload}" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|