diff options
author | rinpatch <rinpatch@sdf.org> | 2019-04-17 12:22:32 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2019-04-17 12:22:32 +0300 |
commit | 627e5a0a4992cc19fc65a7e93a09c470c8e2bf33 (patch) | |
tree | 0f38b475e8554863a1cbbd7750c19d4cd1336eb1 /installation/netbsd | |
parent | d6ab701a14f7c9fb4d59953648c425e04725fc62 (diff) | |
parent | 73df3046e014ae16e03f16a9c82921652cefcb54 (diff) | |
download | pleroma-627e5a0a4992cc19fc65a7e93a09c470c8e2bf33.tar.gz pleroma-627e5a0a4992cc19fc65a7e93a09c470c8e2bf33.zip |
Merge branch 'develop' into feature/database-compaction
Diffstat (limited to 'installation/netbsd')
-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 |