snmp/rc.snmp

Sat, 24 Mar 2012 21:40:49 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 24 Mar 2012 21:40:49 +0100
changeset 414
fd611cde817f
child 588
300d43423c2e
permissions
-rw-r--r--

Introduce many changes to the buildconf and source code including:
(01) clean up, update, and partially update default config files,
(02) seems that Melware is unable to perform release engineering so
update chan_capi to new daily snapshot to solve echo problems,
(03) correct Asterisk inadequate hard coded gmime version check,
(04) force postgresql pthreads linkage to solve build problem,
(05) remove buggy hard coded LibXML configure definitions,
(06) remove local architecture specification to allow GCC
internal logic to determine proper CPU type instead,
(07) remove vendor sound install target causing uncontrolled
downloads and non RPM managed file installation,
(08) solve long outstanding bug in tcptls causing Asterisk
to ignore any intermediate CA certificate signatures,
(09) back out Digium engineering team's bright idea of replacing the
very portable and pervasive POSIX rand(1) with ast_random(), and
then not even implementing it causing all references to fail in
platforms not providing the very new POSIX.1-2008 mkdtemp(3)
function only distributed by BSD and some Linux,
(10) withdraw advanced linker symbol manipulations from SVR5 builds
until either Binutils supports hybrid versioned and anonymous
linker scripts or GCC stops hard coding versioned linker scripts,
(11) correct missing library linkage, some tailored to a specific OS,
(12) remove outdated logic for the no longer distributed gmime-config(1),
(13) remove local gmime buildconf hacks now that Asterisk has corrected
their own build configuration to almost portably support gmime,
(14) solve build problems relating to undetected LibXML paths,
(15) correct erroneous out of tree include definitions,
(16) improve some variable and comment naming,
(17) simplify sound language path hierarchy creation,
and correct australian english installation logic.

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

mercurial