[kwlug-disc] my new favourite command

John Van Ostrand john at netdirect.ca
Fri Dec 3 12:02:11 EST 2010


----- Original Message -----
> > e.g.
> >
> > while :
> > do
> >     read cmd
> >
> >     case "$cmd" in
> >     "load")
> >          ...
> >     "save")
> >          ...
> >     esac
> > done
> 
> Are you thinking something like "select" in Bash/Ksh? "select" will
> give you menu, but I don't think it will go through Readline.

The above example is simplified. It's more than a menu. The actual script is to help manage a system firmware update tool. We plug a server on the network, it PXE boots, runs an NFS rooted Linux and auto starts a system to update firmware. When a failure occurs we want to ssh to the server and run diags, etc. and we want to log what we do. We actually do hundreds of these in a sitting so having handy commands to do this was the goal. We use the serial number of the server as a key, so the idea is to run a shell providing the serial number as an argument and then run a variety of commands that use that serial number to perform a task (like ssh, log, shutdown, etc.)

Currently we just spawn a bash shell with functions that do what we want so we can have readline functionality but it would be more bulletproof if we could lock down the script to certain commands.

-- 
John Van Ostrand 
CTO, co-CEO 
Net Direct Inc. 
564 Weber St. N. Unit 12, Waterloo, ON N2L 5C6 
Ph: 866-883-1172 x5102 
Fx: 519-883-8533 

Linux Solutions / IBM Hardware 




More information about the kwlug-disc_kwlug.org mailing list