2019-09-06 20:53:08 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
#
|
|
|
|
|
# $FreeBSD$
|
|
|
|
|
#
|
|
|
|
|
# PROVIDE: isso
|
|
|
|
|
# REQUIRE: DAEMON
|
|
|
|
|
# KEYWORD: shutdown
|
|
|
|
|
#
|
|
|
|
|
# isso_enable="YES"
|
2019-09-07 23:57:23 +02:00
|
|
|
# isso_bin="/usr/local/bin/isso"
|
|
|
|
|
# isso_config="/usr/local/etc/isso.conf"
|
|
|
|
|
# isso_user="www"
|
2019-09-06 20:53:08 +02:00
|
|
|
#
|
|
|
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
|
|
name=isso
|
|
|
|
|
rcvar=isso_enable
|
|
|
|
|
desc="isso commenting service"
|
|
|
|
|
|
|
|
|
|
load_rc_config ${name}
|
|
|
|
|
|
|
|
|
|
: ${isso_enable:=NO}
|
2019-09-07 23:57:23 +02:00
|
|
|
: ${isso_bin=/usr/local/bin/isso}
|
2019-09-06 20:53:08 +02:00
|
|
|
: ${isso_config=/usr/local/etc/isso.conf}
|
2019-09-07 23:57:23 +02:00
|
|
|
: ${isso_user=www}
|
2019-09-06 20:53:08 +02:00
|
|
|
|
|
|
|
|
logfile=/var/log/isso.log
|
|
|
|
|
pidfile=/var/run/isso.pid
|
2019-09-07 23:57:23 +02:00
|
|
|
command="${isso_bin} -c ${isso_config} run"
|
2019-09-06 20:53:08 +02:00
|
|
|
start_cmd=isso_start
|
2019-09-07 23:57:23 +02:00
|
|
|
status_cmd=isso_status
|
2019-09-06 20:53:08 +02:00
|
|
|
stop_cmd=isso_stop
|
|
|
|
|
procname=/usr/sbin/daemon
|
|
|
|
|
|
|
|
|
|
isso_start()
|
|
|
|
|
{
|
2019-09-07 23:57:23 +02:00
|
|
|
if [ -f ${pidfile} ]; then
|
|
|
|
|
echo "isso is already running (pid=$(cat ${pidfile}))"
|
2019-09-06 20:53:08 +02:00
|
|
|
return 1
|
|
|
|
|
fi
|
2019-09-07 23:57:23 +02:00
|
|
|
export USER=${isso_user}
|
|
|
|
|
export HOME=$(echo ~${isso_user})
|
|
|
|
|
touch ${logfile}
|
|
|
|
|
chmod 640 ${logfile}
|
|
|
|
|
${procname} -P ${pidfile} -u ${isso_user} ${command} >>${logfile} 2>&1
|
|
|
|
|
if [ -f ${pidfile} ]; then
|
|
|
|
|
echo "started isso (pid=$(cat ${pidfile}))"
|
2019-09-06 20:53:08 +02:00
|
|
|
else
|
|
|
|
|
echo "failed to start isso"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-07 23:57:23 +02:00
|
|
|
isso_status()
|
|
|
|
|
{
|
|
|
|
|
if [ -f ${pidfile} ]; then
|
|
|
|
|
echo "isso is running (pid=$(cat ${pidfile}))"
|
|
|
|
|
else
|
|
|
|
|
echo "isso is not running"
|
|
|
|
|
return 1
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-06 20:53:08 +02:00
|
|
|
isso_stop()
|
|
|
|
|
{
|
2019-09-07 23:57:23 +02:00
|
|
|
if [ -f ${pidfile} ]; then
|
2019-09-06 20:53:08 +02:00
|
|
|
local pid=$(cat $pidfile)
|
|
|
|
|
echo "stopping isso (pid=$pid)"
|
|
|
|
|
kill -- -$pid
|
2019-09-08 00:25:39 +02:00
|
|
|
rm -f ${pidfile}
|
2019-09-06 20:53:08 +02:00
|
|
|
else
|
2019-09-07 23:57:23 +02:00
|
|
|
echo "isso is not running"
|
2019-09-06 20:53:08 +02:00
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
run_rc_command "$1"
|