You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.8 KiB
60 lines
1.8 KiB
#!@l_prefix@/bin/openpkg rc |
|
## |
|
## rc.sinopia -- Run-Commands |
|
## |
|
|
|
%config |
|
sinopia_enable="$openpkg_rc_def" |
|
sinopia_flags="" |
|
sinopia_log_prolog="true" |
|
sinopia_log_epilog="true" |
|
sinopia_log_numfiles="10" |
|
sinopia_log_minsize="1M" |
|
sinopia_log_complevel="9" |
|
|
|
%common |
|
sinopia_cfgfile="@l_prefix@/etc/sinopia/sinopia.yaml" |
|
sinopia_pidfile="@l_prefix@/var/sinopia/run/sinopia.pid" |
|
sinopia_logfile="@l_prefix@/var/sinopia/log/sinopia.log" |
|
sinopia_signal () { |
|
[ -f $sinopia_pidfile ] && kill -$1 `cat $sinopia_pidfile` |
|
} |
|
|
|
%status -u @l_rusr@ -o |
|
sinopia_usable="unknown" |
|
sinopia_active="no" |
|
rcService sinopia enable yes && \ |
|
sinopia_signal 0 && sinopia_active="yes" |
|
echo "sinopia_enable=\"$sinopia_enable\"" |
|
echo "sinopia_usable=\"$sinopia_usable\"" |
|
echo "sinopia_active=\"$sinopia_active\"" |
|
|
|
%start -u @l_rusr@ |
|
rcService sinopia enable yes || exit 0 |
|
rcService sinopia active yes && exit 0 |
|
( nohup @l_prefix@/sbin/sinopia --config "$sinopia_cfgfile" $sinopia_flags \ |
|
</dev/null >>$sinopia_logfile 2>&1 & |
|
echo $! >$sinopia_pidfile |
|
) >/dev/null 2>&1 |
|
|
|
%stop -u @l_rusr@ |
|
rcService sinopia enable yes || exit 0 |
|
rcService sinopia active no && exit 0 |
|
sinopia_signal TERM |
|
sleep 2 |
|
rm -f $sinopia_pidfile >/dev/null 2>&1 || true |
|
|
|
%restart -u @l_rusr@ |
|
rcService sinopia enable yes || exit 0 |
|
rcService sinopia active no && exit 0 |
|
rc sinopia stop start |
|
|
|
%daily -u @l_rusr@ |
|
rcService sinopia enable yes || exit 0 |
|
shtool rotate -f \ |
|
-n ${sinopia_log_numfiles} -s ${sinopia_log_minsize} -d \ |
|
-z ${sinopia_log_complevel} -m 664 -o @l_rusr@ -g @l_rgrp@ \ |
|
-P "${sinopia_log_prolog}" \ |
|
-E "${sinopia_log_epilog}; rc sinopia restart" \ |
|
$sinopia_logfile |
|
|
|
|