Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pfSense-pkg-net-snmp: Sync net-snmptrapd in the initialization process #349

Merged
merged 1 commit into from
May 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion net-mgmt/pfSense-pkg-net-snmp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PORTNAME= pfSense-pkg-net-snmp
PORTVERSION= 0.1.2
PORTREVISION= 4
PORTREVISION= 5
CATEGORIES= net-mgmt
MASTER_SITES= # empty
DISTFILES= # empty
Expand Down
10 changes: 9 additions & 1 deletion net-mgmt/pfSense-pkg-net-snmp/files/usr/local/pkg/net-snmp.inc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function netsnmp_cert_get_keyid($cert) {

/* Write snmpd config file */
function netsnmp_resync() {
global $config, $snmpd_config_file, $snmpd_users_file, $snmpd_cert_dir, $snmpd_certkey_dir;
global $config, $g, $snmpd_config_file, $snmpd_users_file, $snmpd_cert_dir, $snmpd_certkey_dir;

/* Global Settings tab */
$nsettings = &$config['installedpackages']['netsnmp']['config'][0];
Expand Down Expand Up @@ -570,6 +570,7 @@ function netsnmp_resync() {

/* When stopping the daemon, use the PID file to locate and kill the process */
$rc_file_stop = <<<EOF
echo "Stopping net-snmpd..."
if [ -e /var/run/net_snmpd.pid ]; then
/bin/kill -9 `/bin/cat /var/run/net_snmpd.pid`
/bin/rm -f /var/run/net_snmpd.pid
Expand All @@ -578,6 +579,7 @@ EOF;

/* When starting the daemon, reap any leftover processes and then start */
$rc_file_start = <<<EOF
echo "Starting net-snmpd..."
# Ensure no other copies of the daemons are running or it breaks.
/usr/bin/killall -9 snmpd 2>/dev/null
sleep 1
Expand All @@ -597,6 +599,10 @@ EOF;

/* Restart the service with the new configuration. */
restart_service('net-snmpd');

if (file_exists("{$g['tmp_path']}/.rc.start_packages.running")) {
netsnmp_resync_snmptrapd();
}
}

/***************************************************************************
Expand Down Expand Up @@ -806,13 +812,15 @@ function netsnmp_resync_snmptrapd() {

/* When stopping the daemon, use the PID file to locate and kill the process */
$rc_file_stop = <<<EOF
echo "Stopping net-snmptrapd..."
if [ -e /var/run/snmptrapd.pid ]; then
/bin/kill -9 `/bin/cat /var/run/snmptrapd.pid`
/bin/rm -f /var/run/snmptrapd.pid
fi
EOF;
/* When starting the daemon, reap any leftover processes and then start */
$rc_file_start = <<<EOF
echo "Starting net-snmptrapd..."
# Ensure no other copies of the daemons are running or it breaks.
/usr/bin/killall -9 snmptrapd 2>/dev/null
sleep 1
Expand Down