Re: SNMP subagent in C + exec_command or similar

Dave Shield <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
2010/5/7 Fulko Hew <[email protected]>:
> Since that command line actually had to spawn 3 sub-processes sort of
> daisy-chained,
> perhaps this might work instead (where a single sub-process is created, that
> then creates
> the daisy-chain (note: I haven't tried it, but its a simple experiment):
>
> ( /bin/cat /proc/cpuinfo | /usr/bin/grep vendor_id | /usr/bin/awk '{print
> $3}')


I doubt that will work.
Fundamentally, you need to invoke some form of shell (sh, bash, csh, etc),
since that is what will interpret the pipeline.
   Anything based on "exec" will invoke the binary that's specified first
on the command line - unless this is a shell binary, then it won't understand
the pipeline syntax.

As I said to Harsszegi earlier today, the simplest answer is to use the
utility function 'run_shell_command' which explicitly invokes a shell to
run the specified command.

Dave

------------------------------------------------------------------------------

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
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.