omshell in a Script
schannel at isc.org
Sat Nov 2 05:02:03 UTC 2013
Do the exit codes have any useful value in these circumstances? I’m not sure about getting exit codes in perl (though I’m sure there is a simple way), but on a shell command line, if you run an omshell command (or any command), then immediately do “echo $?”, the number returned is the exit status of the very previous command (omshell). You can use this usually more reliably and simply than printed output to determine the success of a command.
The return code for success is zero. Anything that is non-zero is either a failure, or that program’s way of communicating specific information or specific kinds of problems (RTFM, politely intended).
Most everything has a useful exit code. I have not got as far as looking into that with omshell myself, but exit codes really should correspond usefully to the actual status / success of the command, and it is a bug in my book if that is not true.
On Nov 1, 2013, at 9:56 AM, Martin McCormick <martin at dc.cis.okstate.edu> wrote:
> I have written a perl script that uses omshell to adjust
> the data bases on a couple of DHCP servers and it makes the
> changes beautifully and as fast as lightning. The bad news is
> that the normal omshell output never echos the command being
> executed. This would allow a routine to translate omshell output
> in to messages to a caller stating that we added xyz to Server 1
> or that abc couldn't be found for deletion on Server2. As it is,
> successful additions or deletions do produce enough output to
> use, but unsuccessful operations don't echo enough to turn in to
> a meaningful message.
> Has anyone figured out how to get omshell to echo text
> or to echo the command it is currently executing? That would
> make it possible to gather needed data for clear messages to the
> My thanks for any constructive ideas.
> Martin McCormick WB5AGZ Stillwater, OK
> Systems Engineer
> OSU Information Technology Department Telecommunications Services Group
> dhcp-users mailing list
> dhcp-users at lists.isc.org
More information about the dhcp-users