diff options
author | Denis Kozadaev <denis@dilos.org> | 2020-01-30 22:13:12 +0300 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2020-03-08 01:36:08 +0100 |
commit | 90ba3e7b1450ec550cc014456302c57b365933b4 (patch) | |
tree | a1d59bab3557f071525cbb0008ca14e3089568dd /dilos/tdenetwork/debian/lisa-trinity.init.2 | |
parent | ae1fcbd1a78ecd53e3880e9d06ed1f10692b18ca (diff) | |
download | tde-packaging-90ba3e7b1450ec550cc014456302c57b365933b4.tar.gz tde-packaging-90ba3e7b1450ec550cc014456302c57b365933b4.zip |
DilOS: tdenetwork build pack
Signed-off-by: Denis Kozadaev <denis@dilos.org>
(cherry picked from commit 0b92bb9645416765f7d0b6dc2686ee3c7a67ed24)
Diffstat (limited to 'dilos/tdenetwork/debian/lisa-trinity.init.2')
-rw-r--r-- | dilos/tdenetwork/debian/lisa-trinity.init.2 | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/dilos/tdenetwork/debian/lisa-trinity.init.2 b/dilos/tdenetwork/debian/lisa-trinity.init.2 new file mode 100644 index 000000000..64088543d --- /dev/null +++ b/dilos/tdenetwork/debian/lisa-trinity.init.2 @@ -0,0 +1,114 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: lisa-trinity +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +### END INIT INFO + + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/lisa +NAME=lisa-trinity +PIDFILE=/var/run/$NAME.pid +DESC="LAN Information Server" + +test -f $DAEMON || exit 0 + +set -e + +is_running () +{ + if [ -e "$PIDFILE" ] + then + #checking if program is running + if [ -L /proc/`cat $PIDFILE`/exe ] + then + #checking for stale pidfile + if grep -q $DAEMON /proc/`cat $PIDFILE`/cmdline + then + #program is running and is called lisa + return 0 + fi + fi + rm -f $PIDFILE + fi + #program is not running + return 1 +} + +case "$1" in + start) + if is_running + then + echo "$DESC is already running. Not doing anything" + exit 0 + fi + echo -n "Starting $DESC: " + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ + > /dev/null + echo $(pidof lisa) > $PIDFILE + echo "$NAME." + ;; + stop) + if ! is_running + then + echo "$DESC is not running. Not doing anything" + exit 0 + fi + echo -n "Stopping $DESC: " + start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE \ + --exec $DAEMON + rm -f $PIDFILE + echo "$NAME." + ;; + reload|force-reload) + echo "Reloading $DESC configuration files." + start-stop-daemon --stop --quiet --signal 1 --pidfile $PIDFILE \ + --exec $DAEMON + ;; + status) + echo -n "$DESC is " + if ! is_running + then + echo -n "not " + fi + echo "running." + + ;; + restart) + echo -n "Restarting $DESC: " + start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE \ + --exec $DAEMON + rm -f $PIDFILE + sleep 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ + > /dev/null + echo $(pidof lisa) > $PIDFILE + echo "$NAME." + ;; + cond-restart) + if ! is_running + then + echo "$DESC is not running. Not doing anything" + exit 0 + fi + echo -n "Restarting $DESC: " + start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE \ + --exec $DAEMON + rm -f $PIDFILE + sleep 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ + > /dev/null + echo $(pidof lisa) > $PIDFILE + echo "$NAME." + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|cond-restart|status|reload|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 |