Running omshell from a Shell Script

Parsley, David L parsley at alfred.edu
Sat Apr 22 11:28:26 UTC 2006


FYI, I wrote the 'omcmd' utility for using omapi from a shell script:
http://freshmeat.net/projects/omcmd/

IMO, much easier than omshell for scripting.

David

--
David L. Parsley
Alfred University Network Systems Administrator
"If I have seen further, it is by standing on ye shoulders of giants."
- Isaac Newton
> -----Original Message-----
> From: dhcp-users-bounce at isc.org [mailto:dhcp-users-bounce at isc.org] On
> Behalf Of Glenn Satchell
> Sent: Saturday, April 22, 2006 4:50 AM
> To: dhcp-users at isc.org
> Subject: Re: Running omshell from a Shell Script
> 
> Line 6 is UUOC and could be better written as
> 
> omshell << EOF
> ...
> EOF
> 
> To debug the script try running bash -x ./scriptname
> The -x echoes each command line before running it, and may give some
> clues. In particular the value of $HOME may be set to something other
> than what you expect when the shell runs. I don't think slowing it
down
> will make any difference.
> 
> regards,
> -glenn
> 
> >X-Original-To: dhcp-users at webster.isc.org
> >To: dhcp-users at isc.org
> >Subject: Running omshell from a Shell Script
> >Date: Fri, 21 Apr 2006 14:03:06 -0500
> >From: Martin McCormick <martin at dc.cis.okstate.edu>
> >
> >	I am testing a bash script which is similar to one which
> >someone posted earlier and it fails unusually under FreeBSD.  It kind
> >of has the earmarks of a timing issue, but I am not sure.
> >
> >	Here is a shell script that shuts down a failover peer or
> >would if it could only connect.
> >
> >#!/usr/local/bin/bash
> ># ARG1 Address of DHCP SERVER
> >#Read in these values from the named file.
> >. $HOME/keys/omshell.conf
> >#Set up the here document.
> >cat << EOF |omshell
> >server $1
> >port $MYPORT
> >key $KEY $SECRET
> >connect
> >new control
> >set state = 00:00:00:02
> >open
> >update
> >EOF
> >
> >	What the output looks like:
> >
> >> > > > dhcpctl_connect: not found
> >> not connected.
> >> no open object.
> >> not connected.
> >> not connected.
> >> <STDIN> line 1: unknown token: EOF
> >EOF
> >^
> >>
> >
> >	If I do all those commands manually, it works as expected.
> >
> >	This may be the wrong group for this question because it
> >appears to not be a problem with omapi but may be a problem with the
> >shell script.  It makes one wonder what would happen if one could
slow
> >it down.  Any ideas are appreciated.
> >
> >Martin McCormick WB5AGZ  Stillwater, OK
> >Systems Engineer
> >OSU Information Technology Department Network Operations Group
> >
> 



More information about the dhcp-users mailing list