#!/bin/bash # # Init file for tellstickd remote light switch daemon # # Written by Magnus Juntti # # chkconfig: 35 54 46 # description: tellstickd remote light switch daemon # # processname: tellstickd # config: /etc/tellstickd.conf # pidfile: /var/run/tellstick . /lib/lsb/init-functions DAEMON="/usr/local/bin/tellstickd" NAME="tellstickd" CONFIG_FILE="/etc/tellstickd.conf" PID_FILE="/var/run/tellstickd.pid" OPTIONS="" [ -x $DAEMON ] || exit 1 [ -r $CONFIG_FILE ] || exit 1 RETVAL=0 prog="tellstickd" desc="remote switch daemon" start() { log_begin_msg "Starting $desc ($prog): " start-stop-daemon --start --quiet --pidfile "$PID_FILE" --name $NAME --exec $DAEMON -- --daemon --config $CONFIG_FILE $OPTIONS log_end_msg $? } stop() { log_begin_msg "Shutting down $desc ($prog): " start-stop-daemon --stop --quiet --pidfile "$PID_FILE" --name $NAME log_end_msg $? } restart() { stop start } reload() { restart # the daemon doesn't reacto to sig HUP, so just restart it # log_begin_msg "Reloading $desc ($prog): " # start-stop-daemon --stop --quiet --pidfile "$PID_FILE" --name $NAME --signal 1 # log_end_msg $? } case "$1" in start) start ;; stop) stop ;; restart) restart ;; reload) reload ;; *) echo $"Usage: $0 {start|stop|restart|reload}" exit 2 esac exit 0