32 lines
765 B
Bash
Executable File
32 lines
765 B
Bash
Executable File
#!/bin/sh /etc/rc.common
|
|
# Author: Johannes Pohl <johannes.pohl@badaix.de>
|
|
START=90
|
|
|
|
USE_PROCD=1
|
|
|
|
NAME=snapserver
|
|
PROG=/usr/bin/$NAME
|
|
PID_FILE=/var/run/$NAME.pid
|
|
CONFIG_FILE=/etc/default/$NAME
|
|
|
|
|
|
start_service()
|
|
{
|
|
local autostart opts
|
|
|
|
autostart=$(grep ^START_SNAPSERVER $CONFIG_FILE |cut -d= -f2)
|
|
[ "$autostart" != "true" ] && logger -t $NAME "Not starting due to START_SNAPSERVER" && exit 0
|
|
|
|
opts=$(grep ^SNAPSERVER_OPTS $CONFIG_FILE |cut -d "\"" -f2)
|
|
opts="--logging.sink system $opts"
|
|
|
|
procd_open_instance
|
|
procd_set_param command $PROG
|
|
procd_append_param command $opts
|
|
procd_set_param pidfile $PID_FILE
|
|
procd_set_param respawn # use the defaults for respawing crashed process
|
|
procd_set_param stderr 1
|
|
procd_set_param stdout 1
|
|
procd_close_instance
|
|
}
|