Thank you pointing me to SIGHUP. I just needed to take care of snmpd.conf
before issuing SIGHUP.
Without this, I was doing all kind of stupid things like forking then
execving etc.

Best regards,
Santosh


On Wed, Jun 5, 2013 at 6:55 PM, <jrego...@rego.org> wrote:

> Using system() to call /etc/init.d/snmpd probably will never work.
>
> /etc/init.d/snmpd is a shell script that sets up and starts snmpd or finds
> the pid and kills it. When you cal system(), you are creating a child
> process that will be stopped when the parent process stops.
>
> If you want to try and have the process read its configuration files
> again, you should have it send itself a SIGHUP signal. That might be the
> only way to achieve your desired action.
>
>  -------- Original Message --------
> Subject: How to restart agent from itself?
> From: santosh <ysa...@gmail.com>
> Date: Wed, June 05, 2013 6:15 am
> To: net-snmp-coders@lists.sourceforge.net
>
> Hi,
>
> I've a private mib implemented as dlmod with a SET oid which should
> restart the snmpd agent.
> I tried the following but didn't work.
>
> case MODE_SET_COMMIT:
>         if( 0 == strncmp("restart", requests->requestvb->val.string,
> requests->requestvb->val_len) ) {
>                 system("/etc/init.d/snmpd restart &", NULL);
>                 exit(0);
>         }
>         break;
>
> With above code restart fails with socket unavailable error.
>
>
> Thanks,
> Santosh
> ------------------------------
>
> ------------------------------------------------------------------------------
> How ServiceNow helps IT people transform IT departments:
> 1. A cloud service to automate IT design, transition and operations
> 2. Dashboards that offer high-level views of enterprise services
> 3. A single system of record for all IT processes
> http://p.sf.net/sfu/servicenow-d2d-j
> ------------------------------
> _______________________________________________
> Net-snmp-coders mailing list
> Net-snmp-coders@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
>
>
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to