freebsd-ports/www/instiki/files/instiki.in
Doug Barton 1d6b4b3f91 Begin the process of deprecating sysutils/rc_subr by
s#. %%RC_SUBR%%#. /etc/rc.subr#
2010-03-27 00:15:24 +00:00

53 lines
1.1 KiB
Bash

#!/bin/sh
#
# PROVIDE: instiki
# REQUIRE: DAEMON
#
# Add the following line to /etc/rc.conf[.local] to enable instiki:
# instiki_enable (bool): Set to "NO" by default
# Set it to "YES" to enable instiki
# instiki_flags (str): Set to "--port %%INSTIKIPORT%% --daemon" by default.
# Extra flags passed to start command
#
. /etc/rc.subr
name="instiki"
rcvar=${name}_enable
start_cmd="${name}_start"
status_cmd="${name}_status"
stop_cmd="${name}_stop"
#rcvar=`set_rcvar`
command="%%WWWDIR%%/instiki.rb"
#command_interpreter="/usr/bin/env"
: ${instiki_enable="NO"}
: ${instiki_flags="--port %%INSTIKIPORT%% --daemon"}
instiki_pid=$(ps x | grep "ruby $command" | grep -v grep | awk '{ print $1 }' )
sig_stop=KILL
instiki_start()
{
unset "start_cmd"
test -n "$instiki_pid" || run_rc_command start
}
instiki_status()
{
if [ -n "$instiki_pid" ] ; then
echo "Instiki is running at pid: $instiki_pid"
else
echo "Instiki is not running."
fi
}
instiki_stop()
{
test -n "$instiki_pid" && kill -$sig_stop $instiki_pid
}
load_rc_config $name
run_rc_command "$1"