diff options
author | rinpatch <rinpatch@sdf.org> | 2018-12-18 21:39:36 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2018-12-18 21:39:36 +0300 |
commit | ef318fb8a96ddf276393f4ec81d3242dd7c6a4d4 (patch) | |
tree | a030123a4bbe071613e87c41bee00333727208dc /installation/netbsd/rc.d | |
parent | 059dd6f681caf14ee9d288ec14b82132be29ae2c (diff) | |
parent | 443d59baa05165c3b5b7ab14f3eabd6f2eba09f2 (diff) | |
download | pleroma-ef318fb8a96ddf276393f4ec81d3242dd7c6a4d4.tar.gz |
Merge branch 'develop' into fix/formatter-ignore-html-chars
Diffstat (limited to 'installation/netbsd/rc.d')
-rwxr-xr-x | installation/netbsd/rc.d/pleroma | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/installation/netbsd/rc.d/pleroma b/installation/netbsd/rc.d/pleroma new file mode 100755 index 000000000..1114668ee --- /dev/null +++ b/installation/netbsd/rc.d/pleroma @@ -0,0 +1,57 @@ +#!/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" +command_args="--detached -S /usr/pkg/bin/mix phx.server" +start_precmd="ulimit -n unlimited" +pidfile="/dev/null" + +pleroma_chdir="${pleroma_home}/pleroma" +pleroma_env="HOME=${pleroma_home} MIX_ENV=prod" + +check_pidfile() +{ + pid=$(pgrep -U "${pleroma_user}" /bin/beam.smp$) + echo -n "${pid}" +} + +if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then + # newer NetBSD + load_rc_config ${name} + run_rc_command "$1" +else + # ancient NetBSD, Solaris and illumos, Linux, etc... + cmd=${1:-start} + + case ${cmd} in + start) + echo "Starting ${name}." + ${start_cmd} + ;; + + stop) + echo "Stopping ${name}." + check_pidfile + ! [ -n ${pid} ] && kill ${pid} + ;; + + restart) + ( $0 stop ) + sleep 5 + $0 start + ;; + + *) + echo 1>&2 "Usage: $0 [start|stop|restart]" + exit 1 + ;; + esac + exit 0 +fi |