From: Martin Mares Date: Sun, 14 Oct 2018 20:19:22 +0000 (+0200) Subject: Switched from Debian initscripts to systemd X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=a4f93e36c6f9c6335ffbbd221a88c6ac0d39171c;p=ursary.git Switched from Debian initscripts to systemd --- diff --git a/Makefile b/Makefile index 1b41fea..a1bdabe 100644 --- a/Makefile +++ b/Makefile @@ -29,4 +29,4 @@ clean: install: all install -m 755 ursaryd /usr/local/sbin/ - install -m 755 debian-init /etc/init.d/ursaryd + install -m 755 burrow-ursary.service /etc/systemd/system/ diff --git a/burrow-ursary.service b/burrow-ursary.service new file mode 100644 index 0000000..f7eabc2 --- /dev/null +++ b/burrow-ursary.service @@ -0,0 +1,13 @@ +[Unit] +Description=Burrow daemon for ursary control panel +After=pulseaudio.service + +[Service] +Type=simple +ExecStart=/usr/local/sbin/ursaryd --no-fork +User=ursary +Group=ursary +KillMode=process + +[Install] +WantedBy=multi-user.target diff --git a/debian-init b/debian-init deleted file mode 100644 index 30e25d4..0000000 --- a/debian-init +++ /dev/null @@ -1,120 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: ursaryd -# Required-Start: $local_fs $remote_fs pulseaudio -# Required-Stop: $local_fs $remote_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Ursary control panel daemon -### END INIT INFO - -# Authors: Martin Mares - -# Do NOT "set -e" - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/usr/sbin:/bin:/usr/bin:/opt/sbin:/opt/bin -DESC="Ursary control panel daemon" -NAME=ursaryd -DAEMON=/usr/local/sbin/ursaryd -DAEMON_ARGS="" -PIDFILE=/run/ursaryd.pid -SCRIPTNAME=/etc/init.d/$NAME - -# Exit if the package is not installed -[ -x "$DAEMON" ] || exit 0 - -# Read configuration variable file if it is present -[ -r /etc/default/$NAME ] && . /etc/default/$NAME - -# Load the VERBOSE setting and other rcS variables -. /lib/init/vars.sh - -# Define LSB log_* functions. -# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. -. /lib/lsb/init-functions - -do_start() -{ - ulimit -c unlimited - ucw-daemon-control --start --pid-file $PIDFILE -- $DAEMON $DAEMON_ARGS -} - -do_stop() -{ - ucw-daemon-control --stop --pid-file $PIDFILE -} - -do_reload() -{ - ucw-daemon-control --reload --pid-file $PIDFILE -} - -do_status() -{ - ucw-daemon-control --check --pid-file $PIDFILE -} - -case "$1" in - start) - [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" - do_start - case "$?" in - 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 100) [ "$VERBOSE" != no ] && log_progress_msg "already running" && log_end_msg 0 ;; - 103) [ "$VERBOSE" != no ] && log_progress_msg "found dead, restarting" && log_end_msg 0 ;; - *) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - stop) - [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" - do_stop - case "$?" in - 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 100) [ "$VERBOSE" != no ] && log_progress_msg "already stopped" && log_end_msg 0 ;; - 103) [ "$VERBOSE" != no ] && log_progress_msg "already dead" && log_end_msg 0 ;; - *) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - reload|force-reload) - log_daemon_msg "Reloading $DESC" "$NAME" - do_reload - case "$?" in - 0) log_end_msg 0 ;; - 101|103) log_progress_msg "is not running" && log_end_msg 1 ;; - *) log_end_msg 1 ;; - esac - ;; - restart) - log_daemon_msg "Restarting $DESC" "$NAME" - do_stop - case "$?" in - 0|100|103) - do_start - case "$?" in - 0|100) log_end_msg 0 ;; - 103) log_progress_msg "was found dead" && log_end_msg 0 ;; - *) log_end_msg 1 ;; - esac - ;; - *) - log_end_msg 1 - ;; - esac - ;; - status) - do_status - case "$?" in - 0) exit 0 ;; - 101) exit 3 ;; - 103) exit 1 ;; - *) exit 4 ;; - esac - ;; - *) - echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2 - exit 3 - ;; -esac - -: