Tue, 28 Aug 2012 18:36:35 +0200
Correct the paths of patched scripts, refine password generation,
mitigate fdatasync(2) detection problems, correct dependencies, remove
outdated autoconf components, correct conf file paths and attributes,
complete and correct log file rotation handing, and note warnings
useful for diagnosing builds.
michael@325 | 1 | #!@l_prefix@/bin/openpkg rc |
michael@325 | 2 | ## |
michael@325 | 3 | ## rc.snmp -- Run-Commands |
michael@325 | 4 | ## |
michael@325 | 5 | |
michael@325 | 6 | %config |
michael@325 | 7 | snmp_enable="$openpkg_rc_def" |
michael@325 | 8 | snmp_daemons="snmpd snmptrapd" |
michael@325 | 9 | snmp_listen="127.0.0.1" |
michael@325 | 10 | snmp_listentrap="127.0.0.1" |
michael@325 | 11 | snmp_log_prolog="true" |
michael@325 | 12 | snmp_log_epilog="true" |
michael@325 | 13 | snmp_log_numfiles="10" |
michael@325 | 14 | snmp_log_minsize="1M" |
michael@325 | 15 | snmp_log_complevel="9" |
michael@325 | 16 | |
michael@325 | 17 | %common |
michael@325 | 18 | snmp_pidfile_snmptrapd="@l_prefix@/var/snmp/snmptrapd.pid" |
michael@325 | 19 | snmp_pidfile_snmpd="@l_prefix@/var/snmp/snmpd.pid" |
michael@325 | 20 | snmp_signal () { |
michael@325 | 21 | [ -f $snmp_pidfile_snmptrapd ] \ |
michael@325 | 22 | && kill -$1 `cat $snmp_pidfile_snmptrapd` |
michael@325 | 23 | local rc_snmptrapd=$? |
michael@325 | 24 | [ -f $snmp_pidfile_snmpd ] \ |
michael@325 | 25 | && kill -$1 `cat $snmp_pidfile_snmpd` |
michael@325 | 26 | local rc_snmpd=$? |
michael@325 | 27 | [ $rc_snmptrapd -eq 0 -o $rc_snmpd -eq 0 ] |
michael@325 | 28 | } |
michael@325 | 29 | |
michael@325 | 30 | %status -u @l_susr@ -o |
michael@325 | 31 | snmp_usable="no" |
michael@325 | 32 | snmp_active="no" |
michael@325 | 33 | rcService snmp enable yes && \ |
michael@325 | 34 | snmp_usable="yes" |
michael@325 | 35 | rcService snmp enable yes && \ |
michael@325 | 36 | snmp_signal 0 && snmp_active="yes" |
michael@325 | 37 | echo "snmp_enable=\"$snmp_enable\"" |
michael@325 | 38 | echo "snmp_usable=\"$snmp_usable\"" |
michael@325 | 39 | echo "snmp_active=\"$snmp_active\"" |
michael@325 | 40 | |
michael@325 | 41 | %start -u @l_susr@ |
michael@325 | 42 | rcService snmp enable yes || exit 0 |
michael@325 | 43 | rcService snmp active yes && exit 0 |
michael@325 | 44 | for daemon in $snmp_daemons; do |
michael@325 | 45 | case "$daemon" in |
michael@325 | 46 | snmpd ) @l_prefix@/sbin/snmpd -Lsd $snmp_listen ;; |
michael@325 | 47 | snmptrapd ) @l_prefix@/sbin/snmptrapd -Lsd $snmp_listentrap ;; |
michael@325 | 48 | esac |
michael@325 | 49 | done |
michael@325 | 50 | |
michael@325 | 51 | %stop -u @l_susr@ |
michael@325 | 52 | rcService snmp enable yes || exit 0 |
michael@325 | 53 | rcService snmp active no && exit 0 |
michael@325 | 54 | snmp_signal TERM |
michael@325 | 55 | |
michael@325 | 56 | %restart -u @l_susr@ |
michael@325 | 57 | rcService snmp enable yes || exit 0 |
michael@325 | 58 | rcService snmp active no && exit 0 |
michael@325 | 59 | rc snmp stop |
michael@325 | 60 | sleep 2 |
michael@325 | 61 | rc snmp start |
michael@325 | 62 | |
michael@325 | 63 | %daily -u @l_susr@ |
michael@325 | 64 | rcService snmp enable yes || exit 0 |
michael@325 | 65 | shtool rotate -f \ |
michael@325 | 66 | -n ${snmp_log_numfiles} -s ${snmp_log_minsize} -d \ |
michael@325 | 67 | -z ${snmp_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \ |
michael@325 | 68 | -P "${snmp_log_prolog}" \ |
michael@325 | 69 | -E "${snmp_log_epilog}" \ |
michael@325 | 70 | @l_prefix@/var/snmp/snmp.log |
michael@325 | 71 |