2018-12-16 12:33:50 +00:00
|
|
|
#!/bin/sh
|
2022-07-06 18:50:01 +00:00
|
|
|
# PROVIDE: akkoma
|
2018-12-16 12:33:50 +00:00
|
|
|
# REQUIRE: DAEMON pgsql
|
|
|
|
|
|
|
|
if [ -f /etc/rc.subr ]; then
|
|
|
|
. /etc/rc.subr
|
|
|
|
fi
|
|
|
|
|
2022-07-06 18:50:01 +00:00
|
|
|
name="akkoma"
|
2018-12-16 12:33:50 +00:00
|
|
|
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
|
|
|
|
2022-07-06 18:50:01 +00:00
|
|
|
akkoma_chdir="${akkoma_home}/akkoma"
|
2022-12-10 02:36:21 +00:00
|
|
|
akkoma_env="HOME=${akkoma_home} MIX_ENV=prod ERL_EPMD_ADDRESS=127.0.0.1"
|
2018-12-16 12:33:50 +00:00
|
|
|
|
|
|
|
check_pidfile()
|
|
|
|
{
|
2022-07-06 18:50:01 +00:00
|
|
|
pid=$(pgrep -U "${akkoma_user}" /bin/beam.smp$)
|
2018-12-16 13:11:17 +00:00
|
|
|
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
|