Re: TrapHandle - Fork & Inform Ack

<[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hi,

I used perl to daemonize (with this fix it works ). I am using NET-SNMP 
version: 5.2.1.2 <http://5.2.1.2>

--- trapHandle.sh ---
#!/bin/sh

# do something something

 CMD="command to execute my program with arguments"
./daemonize.pl "$CMD"
exit 0
--- trapHandle.sh ---

--- daemonize.pl ---
#!/usr/bin/perl

umask 0;
open STDOUT, '>>trapHandle.log' 
open STDERR, '>>trapHandle.log' 
defined(my $pid = fork) or die "Error forking: $!";
exit if $pid;
setsid or die "Error starting new session: $!";

print "@ARGV";
exec @ARGV;
--- daemonize.pl ---

thanks for the help Thomas
chinmaya


On 8/16/05, [email protected] <[email protected]> wrote:
> 
> Hi,
> 
> I am using snmptrapd to receive informs. I noticed that snmptrapd sends 
> Inform Ack only when the 'traphandle' (specified in snmptrapd.conf) 
> finishes the job.
> Is this behavior correct?
> 
> I am trying to make sure that Ack is sent 'before' my traphandle process 
> the inform-request.
> 
> In my case traphandle is a unix shell script. To make sure ack is sent 
> first I tried running my traphandle in background , even tried exec(ing)!
> 
> This does not seems work for me.
> 
> Can any please give any suggestions to get it working !! 
> 
> 
> --- snmptrapd.conf ---
> 
> traphandle default /tmp/trapHandle.sh
> 
> --- snmptrapd.conf ---
> 
> 
> 
> --- trapHandle.sh ---
> 
> #!/bin/sh
> 
> # do something something
> 
> exec myprogram &
> # also tried myprogram &
> 
> exit 0
> 
> --- trapHandle.sh ---
> 
> 
> thanks
> chinmaya
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.