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.
 
 
 
 
 
 

58 lines
1.8 KiB

#!@l_prefix@/bin/openpkg rc
##
## rc.mattermost -- Run-Commands
##
%config
mattermost_enable="$openpkg_rc_def"
mattermost_flags=""
mattermost_log_rotsteps="10"
mattermost_log_rotminsize="10M"
mattermost_log_rotcomplevel="9"
mattermost_log_rotprolog="true"
mattermost_log_rotepilog="true"
%common
mattermost_pidfile="@l_prefix@/var/mattermost/run/mattermost.pid"
mattermost_logfile="@l_prefix@/var/mattermost/log/mattermost.log"
%status -u @l_susr@ -o
mattermost_usable="no"
mattermost_active="no"
[ -f $mattermost_pidfile ] && \
kill -0 `cat $mattermost_pidfile` && \
mattermost_active="yes"
echo "mattermost_enable=\"$mattermost_enable\""
echo "mattermost_usable=\"$mattermost_usable\""
echo "mattermost_active=\"$mattermost_active\""
%start -u @l_rusr@
rcService mattermost enable yes || exit 0
rcService mattermost active yes && exit 0
( cd @l_prefix@/lib/mattermost
nohup @l_prefix@/sbin/mattermost \
</dev/null >>$mattermost_logfile 2>&1 &
echo $! >$mattermost_pidfile
) >/dev/null 2>&1
%stop -u @l_rusr@
rcService mattermost enable yes || exit 0
rcService mattermost active no && exit 0
[ -f $mattermost_pidfile ] && \
kill -TERM `cat $mattermost_pidfile`
sleep 2
%restart -u @l_rusr@
rcService mattermost enable yes || exit 0
rcService mattermost active no && exit 0
rc mattermost stop start
%daily -u @l_susr@
rcService mattermost enable yes || exit 0
shtool rotate -f \
-n $mattermost_log_rotsteps -s $mattermost_log_rotminsize -d \
-z $mattermost_log_rotcomplevel -o @l_rusr@ -g @l_rgrp@ -m 644 \
-P "$mattermost_log_rotprolog" \
-E "$mattermost_log_rotepilog; rc mattermost restart" \
$mattermost_logfile