catsit/rc.catsit
Georg Pfuetzenreuter 6d29c032a7
Sys-V init script
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2022-04-21 18:28:53 +00:00

65 lines
1022 B
Bash

#!/bin/sh
# Trying to run catsit on a Linux kernel
# Georg Pfuetzenrueter <mail@georg-pfuetzenreuter.net>
NAME="catsit"
SVCUSER="gsvc01"
SVCHOME="/var/lib/cradle"
PREFIX="/usr/local"
CONF="$PREFIX/etc/$NAME.conf"
BIN="$PREFIX/sbin/${NAME}d"
rundir="/run/$NAME"
pipe="$rundir/${NAME}d"
pidfile="$rundir/${NAME}d.pid"
command_args="-C ${SVCHOME} -c ${pipe} -p ${pidfile} -t 5 -u ${SVCUSER}"
# Exit if the binary is not installed
if [ ! -x "$BIN" ];
then
exit 0
fi
do_start() {
mkdir $rundir
chown $SVCUSER:$SVCUSER $rundir
$BIN $command_args
}
do_reload() {
pkill -HUP -F $pidfile
}
do_stop() {
pkill -F $pidfile
rmdir $rundir
}
do_status() {
echo "Not properly implemented."
pkill -PWR -F $pidfile
}
case "$1" in
start)
do_start
;;
reload)
do_reload
;;
restart)
do_stop
do_start
;;
stop)
do_stop
;;
status)
do_status
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|reload|status}" >&2
exit 3
;;
esac