Operating System - HP-UX
1834150 Members
2350 Online
110064 Solutions
New Discussion

Re: cgi script accepting html form to do ignite stuff

 
SOLVED
Go to solution
Bill McNAMARA_1
Honored Contributor

cgi script accepting html form to do ignite stuff

Hi,

I'm putting together a web end to ignite:

A web server running on the iux server, has one page:

Select [ drop down list of packages ]

Server [ name of server to ignite ]

[ Ignition Submission button ]


--

So writing this in ksh, how would you reckon it'd look!

Recall the command generated and executed via the cgi-script would be:

# bootsys -a -v -i 'Dropdown list2 text' clientname

Thanks for any help,
Bill
It works for me (tm)
12 REPLIES 12
harry d brown jr
Honored Contributor

Re: cgi script accepting html form to do ignite stuff

ksh? Answer=ugly!!!

Man you are trying to become the ignite master :-)) Why not use perl? It's got what ya need! and It's a lot prettier and easier to maintain.

just my $.000002 worth (tax man loves me)


live free or die
harry
Live Free or Die
Craig Rants
Honored Contributor

Re: cgi script accepting html form to do ignite stuff

I agree, PERL would be much more useful and robust in this application.

If you need an example let me know.

C
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
Sridhar Bhaskarla
Honored Contributor

Re: cgi script accepting html form to do ignite stuff

Bill,

It's not that ugly. PERL is obviously good but ksh is not that bad though. Most of my cgis are through ksh and they work fine. People tend to go for PERL because it has got built-in html modules. But you can do almost equally good job with ksh with sed's and awks. If your form has only "select" tags, it's more easy as you don't have to validate the fields.

So,for your stuff, ksh is more than enough. You are not doing heavy parsing.

1. Get the system|package names
2. Run the commands against them.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
harry d brown jr
Honored Contributor

Re: cgi script accepting html form to do ignite stuff

You can use ksh, but perl is at least 100 times faster. Of course in your app, speed isn't essential. Plus, with perl you can convert it to a "C" binary - the code is ugly, but it works great.


live free or die
harry
Live Free or Die
Bill McNAMARA_1
Honored Contributor

Re: cgi script accepting html form to do ignite stuff

example perl would be nice then.

I got v5.6.1 installed.

the html for the form would be a bonus too!! .. or is that asking too much!

Bill
It works for me (tm)
Sridhar Bhaskarla
Honored Contributor

Re: cgi script accepting html form to do ignite stuff

Looks like you are more inclined to writing perl script. I use perl if I do a lot of text parsing and report generations. As I restate, ksh is more than enough in your case. Attached are simple form.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Craig Rants
Honored Contributor

Re: cgi script accepting html form to do ignite stuff

In defense of perl, attached is a sanitized version of a submission form.
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
Wodisch
Honored Contributor

Re: cgi script accepting html form to do ignite stuff

Hello Bill,

why do you not use the DeskTopKornShell?
dtksh is quite simple and fast for the GUI part of it.
You do have to know how to write Motif programs in C, but it is not that difficult...

Just my $0.02,
Wodisch
Bill McNAMARA_1
Honored Contributor

Re: cgi script accepting html form to do ignite stuff

okay, so this form works:
[ see attached ]
and it should work for all ignites.

So, If the two inputs of the form are:
IPADDR and ARCHIVE,
and I've selected the submit button to run script ignite.pl

What would script ignite.pl look like to run the command:

bootsys -a -v -i '$ARCHIVE' $IPADDR

?

Thanks,
Bill
It works for me (tm)
Bill McNAMARA_1
Honored Contributor

Re: cgi script accepting html form to do ignite stuff

There's a pretty cool program (freeware) called uncgi that'll take all form input and put it into environment variables.
http://www.phys.lsu.edu/astro/tohline/uncgi-bin/
It works just fine.!

Thanks.
Bill
It works for me (tm)
Bill McNAMARA_1
Honored Contributor

Re: cgi script accepting html form to do ignite stuff

here's the ksh to do the job with uncgi for those interested:

#!/bin/ksh
# create ignite cmd
#
# bill : wma@teamlog.fr

echo "Content-type: text/html"
echo ""
echo " Ignition > > > "
echo "

$(/usr/bin/date)

"
echo "$WWW_ipaddress getting $WWW_archive"
echo "

sending command:

"
echo "
"
echo "/opt/ignite/bin/bootsys -a -d -v -i '$WWW_archive' $WWW_ipaddress"
echo "id: \c"
id
#
# would be a good idea to do a ping to ensure the system is up
# if not, send bch boot info
# Also mention the /.rhosts
# the hist.log, out.log and err.log files need to be accessible in /var/www/cgi-bin/
#
/opt/ignite/bin/bootsys -a -d -v -i "${WWW_archive}" $WWW_ipaddress 1>out.log 2> err.log
echo "
"
echo " * $WWW_ipaddress | $WWW_archive | $(/usr/bin/date) | " >> hist.log
echo "
Logging $REMOTE_ADDR, ip, username and request to file"
echo ""


Later,
Bill
It works for me (tm)
Ralph Grothe
Honored Contributor
Solution

Re: cgi script accepting html form to do ignite stuff

 
Madness, thy name is system administration