62 lines
1.1 KiB
Bash
Executable File
62 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
# PROVIDE: isso
|
|
# REQUIRE: DAEMON
|
|
# KEYWORD: shutdown
|
|
#
|
|
# isso_enable="YES"
|
|
#
|
|
|
|
. /etc/rc.subr
|
|
|
|
name=isso
|
|
rcvar=isso_enable
|
|
desc="isso commenting service"
|
|
|
|
load_rc_config ${name}
|
|
|
|
: ${isso_enable:=NO}
|
|
: ${isso_config=/usr/local/etc/isso.conf}
|
|
|
|
logfile=/var/log/isso.log
|
|
pidfile=/var/run/isso.pid
|
|
command=/usr/local/bin/isso
|
|
start_cmd=isso_start
|
|
stop_cmd=isso_stop
|
|
procname=/usr/sbin/daemon
|
|
|
|
is_process_running="[ -f $pidfile ] && procstat $(cat $pidfile) >/dev/null 2>&1"
|
|
|
|
isso_start()
|
|
{
|
|
if is_process_running; then
|
|
echo "isso is already running (pid=$(cat $pidfile))"
|
|
return 1
|
|
fi
|
|
export USER=www
|
|
export HOME=$(echo ~www)
|
|
touch $logfile
|
|
chmod 640 $logfile
|
|
/usr/sbin/daemon -P $pidfile -u www /usr/local/bin/isso -c ${isso_config} run >>$logfile 2>&1
|
|
if is_process_running; then
|
|
echo "started isso (pid=$(cat $pidfile))"
|
|
else
|
|
echo "failed to start isso"
|
|
fi
|
|
}
|
|
|
|
isso_stop()
|
|
{
|
|
if is_process_running; then
|
|
local pid=$(cat $pidfile)
|
|
echo "stopping isso (pid=$pid)"
|
|
kill -- -$pid
|
|
else
|
|
echo "isso isn't running"
|
|
fi
|
|
}
|
|
|
|
run_rc_command "$1"
|