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.
64 lines
1.8 KiB
64 lines
1.8 KiB
#!@l_prefix@/bin/openpkg rc |
|
## |
|
## rc.hydra -- Run-Commands |
|
## |
|
|
|
%config |
|
hydra_enable="$openpkg_rc_def" |
|
hydra_flags="" |
|
hydra_log_prolog="true" |
|
hydra_log_epilog="true" |
|
hydra_log_numfiles="10" |
|
hydra_log_minsize="1M" |
|
hydra_log_complevel="9" |
|
|
|
%common |
|
hydra_cfgfile="@l_prefix@/etc/hydra/hydra.yaml" |
|
hydra_pidfile="@l_prefix@/var/hydra/run/hydra.pid" |
|
hydra_logfile="@l_prefix@/var/hydra/log/hydra.log" |
|
hydra_signal () { |
|
[ -f $hydra_pidfile ] && kill -$1 `cat $hydra_pidfile` |
|
} |
|
|
|
%status -u @l_rusr@ -o |
|
hydra_usable="unknown" |
|
hydra_active="no" |
|
rcService hydra enable yes && \ |
|
hydra_signal 0 && hydra_active="yes" |
|
echo "hydra_enable=\"$hydra_enable\"" |
|
echo "hydra_usable=\"$hydra_usable\"" |
|
echo "hydra_active=\"$hydra_active\"" |
|
|
|
%start -u @l_rusr@ |
|
rcService hydra enable yes || exit 0 |
|
rcService hydra active yes && exit 0 |
|
( GOMAXPROCS=32 |
|
export GOMAXPROCS |
|
nohup @l_prefix@/bin/hydra host \ |
|
--config $hydra_cfgfile \ |
|
$hydra_flags \ |
|
</dev/null >>$hydra_logfile 2>&1 & |
|
echo $! >$hydra_pidfile |
|
) >/dev/null 2>&1 |
|
|
|
%stop -u @l_rusr@ |
|
rcService hydra enable yes || exit 0 |
|
rcService hydra active no && exit 0 |
|
hydra_signal TERM |
|
sleep 2 |
|
rm -f $hydra_pidfile >/dev/null 2>&1 || true |
|
|
|
%restart -u @l_rusr@ |
|
rcService hydra enable yes || exit 0 |
|
rcService hydra active no && exit 0 |
|
rc hydra stop start |
|
|
|
%daily -u @l_susr@ |
|
rcService hydra enable yes || exit 0 |
|
shtool rotate -f \ |
|
-n ${hydra_log_numfiles} -s ${hydra_log_minsize} -d \ |
|
-z ${hydra_log_complevel} -m 664 -o @l_rusr@ -g @l_rgrp@ \ |
|
-P "${hydra_log_prolog}" \ |
|
-E "${hydra_log_epilog}; rc hydra restart" \ |
|
$hydra_logfile |
|
|
|
|