File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # ###############################################################
3+ # copy this script to /etc/snmp/ and make it executable: #
4+ # chmod +x /etc/snmp/securityupdate #
5+ # ------------------------------------------------------------ #
6+ # edit your snmpd.conf and include: #
7+ # extend securityupdate /etc/snmp/securityupdate #
8+ # --------------------------------------------------------------#
9+ # restart snmpd and activate the app for desired host #
10+ # --------------------------------------------------------------#
11+ # please make sure you have the path/binaries below #
12+ # ###############################################################
13+ BIN_WC=' /usr/bin/env wc'
14+ BIN_GREP=' /usr/bin/env grep'
15+ CMD_GREP=' -c'
16+ CMD_WC=' -l'
17+ BIN_APT=' /usr/bin/env apt-get'
18+ CMD_APT=' -qq -s upgrade'
19+
20+ # ###############################################################
21+ # Don't change anything unless you know what are you doing #
22+ # ###############################################################
23+ if command -v apt-get & > /dev/null ; then
24+ # Debian / Devuan / Ubuntu
25+ # shellcheck disable=SC2086
26+ UPDATES=$( $BIN_APT $CMD_APT | $BIN_GREP ' Inst' | $BIN_GREP $CMD_GREP ' -security' )
27+ if [ " $UPDATES " -ge 1 ]; then
28+ echo " $UPDATES " ;
29+ else
30+ echo " 0" ;
31+ fi
32+ else
33+ echo " 0" ;
34+ fi
You can’t perform that action at this time.
0 commit comments