Created
November 28, 2011 04:01
-
-
Save n0ts/1399039 to your computer and use it in GitHub Desktop.
/usr/local/rc.d/tiarra rc script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
. /etc/rc.subr | |
name=tiarra | |
rcvar=`set_rcvar` | |
# read settings, set default values | |
load_rc_config $name | |
: ${tiarra_enable="NO"} | |
: ${tiarra_bin="/home/w/prj/coderepos/tiarra/tiarra"} | |
: ${tiarra_pidfile="/home/w/var/run/tiarra.pid"} | |
: ${tiarra_config="/home/w/etc/tiarra.conf"} | |
start_cmd=tiarra_start | |
stop_cmd=tiarra_stop | |
status_cmd=tiarra_status | |
extra_commands="status" | |
tiarra_start() { | |
if checkyesno tiarra_enable; then | |
daemon -p $tiarra_pidfile -u n0ts $tiarra_bin --config=$tiarra_config --no-fork --quiet | |
fi | |
} | |
tiarra_stop() { | |
if [ -f $tiarra_pidfile ]; then | |
kill `cat $tiarra_pidfile` | |
fi | |
} | |
tiarra_status() { | |
if [ -n "`pgrep -F $tiarra_pidfile`" ]; then | |
echo "tiarra is running" | |
else | |
echo "tiarra is not running" | |
exit 1 | |
fi | |
} | |
run_rc_command "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment