jabberd/rc.jabberd

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 541
869d6847b13e
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

     1 #!@l_prefix@/bin/openpkg rc
     2 ##
     3 ##  rc.jabberd -- Run-Commands
     4 ##
     6 %config
     7     jabberd_enable="$openpkg_rc_def"
     8     jabberd_hostname=`hostname`
     9     jabberd_daemons="c2s router s2s sm"
    10     jabberd_cfgfile="@l_prefix@/etc/jabberd/jabberd.cfg"
    11     jabberd_log_prolog="true"
    12     jabberd_log_epilog="true"
    13     jabberd_log_numfiles="10"
    14     jabberd_log_minsize="1M"
    15     jabberd_log_complevel="9"
    17 %common
    18     jabberd_signal () {
    19         local retcode=1
    20         local daemons=
    21         for daemons in $jabberd_daemons; do
    22             [ -f @l_prefix@/var/jabberd/pid/${daemons}.pid ] \
    23             && kill -$1 `cat @l_prefix@/var/jabberd/pid/${daemons}.pid` \
    24             && retcode=$?
    25         done
    26         return $retcode
    27     }
    29 %status -u @l_nusr@ -o
    30     jabberd_usable="unknown"
    31     jabberd_active="no"
    32     rcService jabberd enable yes && \
    33         jabberd_signal 0 && jabberd_active="yes"
    34     echo "jabberd_enable=\"$jabberd_enable\""
    35     echo "jabberd_usable=\"$jabberd_usable\""
    36     echo "jabberd_active=\"$jabberd_active\""
    38 %start -u @l_nusr@
    39     rcService jabberd enable yes || exit 0
    40     rcService jabberd active yes && exit 0
    41     @l_prefix@/bin/jabberd -b -c $jabberd_cfgfile
    43 %stop -u @l_nusr@
    44     rcService jabberd enable yes || exit 0
    45     rcService jabberd active no && exit 0
    46     jabberd_signal TERM
    47     sleep 2
    48     for daemons in $jabberd_daemons; do
    49         rm -f @l_prefix@/var/jabberd/pid/${daemons}.pid
    50     done
    52 %restart -u @l_nusr@
    53     rcService jabberd enable yes || exit 0
    54     rcService jabberd active no && exit 0
    55     rc jabberd stop
    56     sleep 2
    57     rc jabberd start
    59 %daily -u @l_nusr@
    60     rcService jabberd enable yes || exit 0
    61     logfiles=
    62     for daemons in $jabberd_daemons; do
    63         logfiles="$logfiles @l_prefix@/var/jabberd/log/$daemons.log"
    64     done
    65     shtool rotate -f \
    66         -n ${jabberd_log_numfiles} -s ${jabberd_log_minsize} -d \
    67         -z ${jabberd_log_complevel} -m 644 -o @l_nusr@ -g @l_ngrp@ \
    68         -P "${jabberd_log_prolog}" \
    69         -E "${jabberd_log_epilog}; rc jabberd restart" \
    70         $logfiles

mercurial