Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
michael@191 | 1 | #!@l_prefix@/bin/openpkg rc |
michael@191 | 2 | ## |
michael@191 | 3 | ## rc.spamassassin -- Run-Commands |
michael@191 | 4 | ## |
michael@191 | 5 | |
michael@191 | 6 | %config |
michael@191 | 7 | spamassassin_enable="$openpkg_rc_def" |
michael@191 | 8 | spamassassin_bind="127.0.0.1" |
michael@191 | 9 | spamassassin_port="783" |
michael@192 | 10 | spamassassin_flags="-x -u @l_rusr@ -A 127. --local --virtual-config-dir=@l_prefix@/var/spamassassin/spool/%u" |
michael@191 | 11 | spamassassin_stop_delay="2" |
michael@191 | 12 | spamassassin_log_prolog="true" |
michael@191 | 13 | spamassassin_log_epilog="true" |
michael@191 | 14 | spamassassin_log_numfiles="10" |
michael@191 | 15 | spamassassin_log_minsize="1M" |
michael@191 | 16 | spamassassin_log_complevel="9" |
michael@191 | 17 | |
michael@191 | 18 | %common |
michael@191 | 19 | spamassassin_etcdir="@l_prefix@/etc/spamassassin" |
michael@191 | 20 | spamassassin_pidfile="@l_prefix@/var/spamassassin/spamassassin.pid" |
michael@191 | 21 | spamassassin_logfile="@l_prefix@/var/spamassassin/spamassassin.log" |
michael@191 | 22 | spamassassin_signal () { |
michael@191 | 23 | [ -f $spamassassin_pidfile ] && kill -$1 `cat $spamassassin_pidfile` |
michael@191 | 24 | } |
michael@191 | 25 | |
michael@191 | 26 | %status -u @l_susr@ -o |
michael@191 | 27 | spamassassin_usable="unknown" |
michael@191 | 28 | spamassassin_active="no" |
michael@191 | 29 | rcService spamassassin enable yes && \ |
michael@191 | 30 | spamassassin_signal 0 && spamassassin_active="yes" |
michael@191 | 31 | echo "spamassassin_enable=\"$spamassassin_enable\"" |
michael@191 | 32 | echo "spamassassin_usable=\"$spamassassin_usable\"" |
michael@191 | 33 | echo "spamassassin_active=\"$spamassassin_active\"" |
michael@191 | 34 | |
michael@191 | 35 | %start -p 400 -u @l_susr@ |
michael@191 | 36 | rcService spamassassin enable yes || exit 0 |
michael@191 | 37 | rcService spamassassin active yes && exit 0 |
michael@191 | 38 | @l_prefix@/bin/spamd \ |
michael@191 | 39 | --daemonize \ |
michael@191 | 40 | --siteconfigpath="${spamassassin_etcdir}" \ |
michael@191 | 41 | --pidfile="${spamassassin_pidfile}" \ |
michael@191 | 42 | --syslog="${spamassassin_logfile}" \ |
michael@191 | 43 | --listen-ip="${spamassassin_bind}" \ |
michael@191 | 44 | --port="${spamassassin_port}" \ |
michael@191 | 45 | ${spamassassin_flags} |
michael@191 | 46 | |
michael@191 | 47 | %stop -p 400 -u @l_susr@ |
michael@191 | 48 | rcService spamassassin enable yes || exit 0 |
michael@191 | 49 | rcService spamassassin active no && exit 0 |
michael@191 | 50 | spamassassin_signal TERM |
michael@191 | 51 | sleep "$spamassassin_stop_delay" |
michael@191 | 52 | |
michael@191 | 53 | %restart -p 600 -u @l_susr@ |
michael@191 | 54 | rcService spamassassin enable yes || exit 0 |
michael@191 | 55 | rcService spamassassin active no && exit 0 |
michael@191 | 56 | rc spamassassin stop |
michael@191 | 57 | rc spamassassin start |
michael@191 | 58 | |
michael@191 | 59 | %daily -u @l_susr@ |
michael@191 | 60 | rcService spamassassin enable yes || exit 0 |
michael@191 | 61 | shtool rotate -f \ |
michael@191 | 62 | -n ${spamassassin_log_numfiles} -s ${spamassassin_log_minsize} -d \ |
michael@191 | 63 | -z ${spamassassin_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \ |
michael@191 | 64 | -P "${spamassassin_log_prolog}" \ |
michael@191 | 65 | -E "${spamassassin_log_epilog}; rc spamassassin restart" \ |
michael@191 | 66 | $spamassassin_logfile |
michael@191 | 67 |