#! /bin/sh # start/stop openupsd daemon # daemon action -- needed sometimes to get script invoked.. CONFFILE=/etc/openupsd.conf DAEMON=/usr/local/bin/openupsd DARGS=-v if [ ! -f $CONFFILE ]; then echo "failed to start UPS daemon: missing configuration $CONFFILE" exit 1 fi case "$1" in start) echo -n "starting UPS daemon: " RUNNING= pgrep -f $DAEMON > /dev/null && RUNNING=1 if [ $RUNNING ]; then echo "already running." else $DAEMON -c $CONFFILE $DARGS echo "done." fi ;; stop) echo -n "stopping UPS daemon: " RUNNING= pgrep -f $DAEMON > /dev/null && RUNNING=1 if [ $RUNNING ]; then kill -INT `pgrep -f $DAEMON` echo "done." else echo "not running." fi ;; *) echo "Usage: $0 {start|stop}" exit 1 ;; esac exit 0