honkoma/installation/netbsd/rc.d/pleroma

58 lines
969 B
Plaintext
Raw Permalink Normal View History

2018-12-16 12:33:50 +00:00
#!/bin/sh
# PROVIDE: pleroma
# REQUIRE: DAEMON pgsql
if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
name="pleroma"
rcvar=${name}
command="/usr/pkg/bin/elixir"
2018-12-16 13:11:17 +00:00
command_args="--detached -S /usr/pkg/bin/mix phx.server"
2018-12-16 12:33:50 +00:00
start_precmd="ulimit -n unlimited"
2018-12-16 13:11:17 +00:00
pidfile="/dev/null"
2018-12-16 12:33:50 +00:00
pleroma_chdir="${pleroma_home}/pleroma"
pleroma_env="HOME=${pleroma_home} MIX_ENV=prod"
check_pidfile()
{
2018-12-16 13:11:17 +00:00
pid=$(pgrep -U "${pleroma_user}" /bin/beam.smp$)
echo -n "${pid}"
2018-12-16 12:33:50 +00:00
}
2018-12-16 13:11:17 +00:00
if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
# newer NetBSD
2018-12-16 12:33:50 +00:00
load_rc_config ${name}
run_rc_command "$1"
2018-12-16 13:11:17 +00:00
else
# ancient NetBSD, Solaris and illumos, Linux, etc...
2018-12-16 12:33:50 +00:00
cmd=${1:-start}
case ${cmd} in
start)
echo "Starting ${name}."
${start_cmd}
;;
stop)
echo "Stopping ${name}."
2018-12-16 13:11:17 +00:00
check_pidfile
! [ -n ${pid} ] && kill ${pid}
2018-12-16 12:33:50 +00:00
;;
restart)
( $0 stop )
sleep 5
$0 start
;;
*)
echo 1>&2 "Usage: $0 [start|stop|restart]"
exit 1
;;
esac
exit 0
fi