postfix/rc.postfix

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
permissions
-rw-r--r--

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

michael@146 1 #!@l_prefix@/bin/openpkg rc
michael@146 2 ##
michael@146 3 ## rc.postfix -- Run-Commands
michael@146 4 ##
michael@146 5
michael@146 6 %config
michael@146 7 MTA_name="postfix"
michael@146 8 MTA_aliases_file="@l_prefix@/etc/postfix/aliases"
michael@146 9 MTA_aliases_update="cd @l_prefix@/etc/postfix && @l_prefix@/sbin/postalias aliases"
michael@146 10 postfix_enable="$openpkg_rc_def"
michael@146 11 postfix_log_prolog="true"
michael@146 12 postfix_log_epilog="true"
michael@146 13 postfix_log_numfiles="10"
michael@146 14 postfix_log_minsize="1M"
michael@146 15 postfix_log_complevel="9"
michael@146 16 postfix_sum_flags=""
michael@146 17
michael@146 18 %status -u @l_susr@ -o
michael@146 19 postfix_usable="no"
michael@146 20 postfix_active="no"
michael@146 21 @l_prefix@/sbin/postfix check >/dev/null 2>&1 && postfix_usable="yes"
michael@146 22 @l_prefix@/libexec/postfix/master -t >/dev/null 2>&1 || postfix_active="yes"
michael@146 23 echo "postfix_enable=\"$postfix_enable\""
michael@146 24 echo "postfix_usable=\"$postfix_usable\""
michael@146 25 echo "postfix_active=\"$postfix_active\""
michael@146 26
michael@146 27 %start -u @l_susr@
michael@146 28 rcService postfix enable yes || exit 0
michael@146 29 rcService postfix active yes && exit 0
michael@146 30 @l_prefix@/sbin/postfix start
michael@146 31
michael@146 32 %stop -u @l_susr@
michael@146 33 rcService postfix enable yes || exit 0
michael@146 34 rcService postfix active no && exit 0
michael@146 35 @l_prefix@/sbin/postfix stop
michael@146 36 sleep 2
michael@146 37
michael@146 38 %restart -u @l_susr@
michael@146 39 rcService postfix enable yes || exit 0
michael@146 40 rcService postfix active no && exit 0
michael@146 41 rc postfix stop start
michael@146 42
michael@146 43 %reload -u @l_susr@
michael@146 44 rcService postfix enable yes || exit 0
michael@146 45 rcService postfix active no && exit 0
michael@146 46 @l_prefix@/sbin/postfix reload
michael@146 47
michael@146 48 %daily -u @l_susr@
michael@146 49 rcService postfix enable yes || exit 0
michael@146 50
michael@146 51 # rotate summary logfile
michael@146 52 shtool rotate -f \
michael@146 53 -n ${postfix_log_numfiles} -s 0 \
michael@146 54 -z ${postfix_log_complevel} -m 644 -o @l_musr@ -g @l_mgrp@ \
michael@146 55 @l_prefix@/var/postfix/log/postfix.sum
michael@146 56
michael@146 57 # generate summary logfile
michael@146 58 logfiles="@l_prefix@/var/postfix/log/postfix.log"
michael@146 59 if [ -f "@l_prefix@/var/postfix/log/postfix.log.0" ]; then
michael@146 60 logfiles="$logfiles @l_prefix@/var/postfix/log/postfix.log.0"
michael@146 61 fi
michael@146 62 @l_prefix@/sbin/pflogsumm -d yesterday -h 10 -u 10 -i \
michael@146 63 --iso_date_time --problems_first --smtpd_stats --verbose_msg_detail \
michael@146 64 ${postfix_sum_flags} \
michael@146 65 ${logfiles} >@l_prefix@/var/postfix/log/postfix.sum 2>/dev/null
michael@146 66
michael@146 67 # rotate logfile
michael@146 68 shtool rotate -f \
michael@146 69 -n ${postfix_log_numfiles} -s ${postfix_log_minsize} -d \
michael@146 70 -z ${postfix_log_complevel} -m 644 -o @l_musr@ -g @l_mgrp@ \
michael@146 71 -P "$postfix_log_prolog" \
michael@146 72 -E "$postfix_log_epilog" \
michael@146 73 @l_prefix@/var/postfix/log/postfix.log
michael@146 74

mercurial