4 * Copyright (C) 2011 shibby
15 if( nvram_match( "snmp_enable", "1" ) )
18 // writing data to file
19 if( !( fp
= fopen( "/etc/snmpd.conf", "w" ) ) )
21 perror( "/etc/snmpd.conf" );
24 fprintf(fp
, "syslocation %s\n", nvram_safe_get( "snmp_location" ) );
25 fprintf(fp
, "syscontact %s <%s>\n", nvram_safe_get( "snmp_contact" ),nvram_safe_get( "snmp_contact" ) );
26 fprintf(fp
, "rocommunity %s\n", nvram_safe_get( "snmp_ro" ) );
29 chmod( "/etc/snmpd.conf", 0644 );
31 xstart( "snmpd", "-c", "/etc/snmpd.conf" );
39 killall("snmpd", SIGTERM
);