#!@l_prefix@/bin/openpkg rc ## ## rc.postgraphql -- Run-Commands ## %config postgraphql_enable="$openpkg_rc_def" postgraphql_flags="--host localhost --port 3000 postgres://localhost:5432/example" postgraphql_log_prolog="true" postgraphql_log_epilog="true" postgraphql_log_numfiles="10" postgraphql_log_minsize="1M" postgraphql_log_complevel="9" %common postgraphql_pidfile="@l_prefix@/var/postgraphql/run/postgraphql.pid" postgraphql_logfile="@l_prefix@/var/postgraphql/log/postgraphql.log" postgraphql_signal () { [ -f $postgraphql_pidfile ] && kill -$1 `cat $postgraphql_pidfile` } %status -u @l_nusr@ -o postgraphql_usable="unknown" postgraphql_active="no" rcService postgraphql enable yes && \ postgraphql_signal 0 && postgraphql_active="yes" echo "postgraphql_enable=\"$postgraphql_enable\"" echo "postgraphql_usable=\"$postgraphql_usable\"" echo "postgraphql_active=\"$postgraphql_active\"" %start -u @l_nusr@ rcService postgraphql enable yes || exit 0 rcService postgraphql active yes && exit 0 ( nohup @l_prefix@/bin/postgraphql $postgraphql_flags \ >$postgraphql_logfile 2>&1 & echo $! >$postgraphql_pidfile ) >/dev/null 2>&1 %stop -u @l_nusr@ rcService postgraphql enable yes || exit 0 rcService postgraphql active no && exit 0 postgraphql_signal TERM sleep 2 rm -f $postgraphql_pidfile >/dev/null 2>&1 || true %restart -u @l_nusr@ rcService postgraphql enable yes || exit 0 rcService postgraphql active no && exit 0 rc postgraphql stop start %daily -u @l_susr@ rcService postgraphql enable yes || exit 0 shtool rotate -f \ -n ${postgraphql_log_numfiles} -s ${postgraphql_log_minsize} -d \ -z ${postgraphql_log_complevel} -m 664 -o @l_nusr@ -g @l_ngrp@ \ -P "${postgraphql_log_prolog}" \ -E "${postgraphql_log_epilog}; rc postgraphql restart" \ $postgraphql_logfile