![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help me in sending parameters from sqlplus script to unix shell script | Hara | Shell Programming and Scripting | 2 | 01-29-2008 12:31 PM |
| Shell Script: want to insert values in database when update script runs | ring | Shell Programming and Scripting | 1 | 10-25-2007 12:06 AM |
| here document to automate perl script that call script | hogger84 | Shell Programming and Scripting | 3 | 10-22-2007 07:15 AM |
| returning to the parent shell after invoking a script within a script | gurukottur | Shell Programming and Scripting | 5 | 09-26-2006 04:05 AM |
| return valuse from child script to parent script | borncrazy | Shell Programming and Scripting | 1 | 08-20-2004 12:39 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Run ksh script from cgi
Hi,
I'm developing a system which requires me to run a ksh script from within a cgi script. What sort of syntax will I need to do this, I'm sure it's simple but can't find out how anywhere! Thanks. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
In your html you simply place the script you are going to run:
Code:
<HTML> <HEAD> <TITLE>Problem-solver</TITLE> </HEAD> <BODY TEXT vlink="black" link="blue" alink="white" > <CENTER><STRONG>General Answer Generator</STRONG></CENTER> <p> Enter a short description of your computing problem in the box. The program wil l give back a suggestion on how to solve the problem. <form name="myform" action=/cgi-bin/gag.cgi> <p> <input type=text name="alertmsg" maxlength="40" size="80"></p> <input type="submit" value="Submit your problem"> <input type="reset"> </form> <HR size=2 noshade> </BODY> </HTML> Then you put your script (what ever language you want to use) in the cgi-bin directory (insure you chmod to allow execution). This is an example: Code:
#!/bin/ksh # echo "Content-type: text/html" echo # # echo " <BODY>" echo "<BODY TEXT vlink=\"black\" link=\"blue\" alink=\"white\" >" echo "<CENTER><STRONG>General Answer Generator</STRONG></CENTER>" echo "<p>" echo " " echo "`/yourDIR/cgi-bin/getalert $QUERY_STRING'" echo " " echo "<p>" echo "Enter a short description of your computing problem in the box. The progr am will give back a suggestion on how to solve the problem." echo "<form name=\"myform\" >" echo "<p>" echo "<p><input type=text name="alertmsg" maxlength=\"40\" size=80> </p>" echo "<input type=\"submit\" value=\"Submit your problem\">" echo "<input type=\"reset\" >" echo "<HR size=2 noshade>" echo "" echo " </BODY>" echo "</NOFRAMES>" exit Code:
#!/bin/ksh
#
#
alertmsg="Wow, you stumped me. Have you tried rebooting?"
alert1msg="Check the web documentation pages for information on the problem"
alert2msg="Check the set up of the computer"
alert3msg="Check for any network issues"
alert4msg="Check for any Change Controls that may have caused the problem"
alert5msg="Hmm, have you tried rebooting?"
#
alert1=`echo $1 | grep -ci unix`
alert2=`echo $1 | grep -ci not`
alert3=`echo $1 | grep -ci network`
alert4=`echo $1 | grep -ci change`
alert5=`echo $1 | grep -ci pc`
#
if [ alert1 -gt 0 ] ; then
alertmsg=$alert1msg
fi
if [ alert2 -gt 0 ] ; then
alertmsg=$alert2msg
fi
if [ alert3 -gt 0 ] ; then
alertmsg=$alert3msg
fi
if [ alert4 -gt 0 ] ; then
alertmsg="$alert4msg"
fi
if [ alert5 -gt 0 ] ; then
alertmsg="$alert5msg"
fi
#
exit
|
|
#3
|
|||
|
|||
|
I have a related question, somehow I don't know why all my posts to alt.apache.configuration were blocked (no I didn't spam --- and I didn't have ever posted to that newsgroup).
I would like to use a TCL script as a CGI script. However, somehow Apache returns the type as application/x-tcl that prevents it from being handled properly by browsers (marked below). =========================== cbkihong@cbkihong:~/public_html/cgi-bin> telnet localhost 80 Trying ::1... Connected to localhost. Escape character is '^]'. GET /~cbkihong/cgi-bin/ip.tcl HTTP/1.0 HTTP/1.1 200 OK Date: Tue, 27 May 2003 10:35:07 GMT Server: Apache/2.0.43 (Unix) mod_perl/1.99_07-dev Perl/v5.8.0 DAV/2 PHP/4.3.1 Content-Length: 91 Connection: close Content-Type: application/x-tcl <<<<------------------- Content-Type: text/html <html> <body> <p>Your IP address is ::1</p> </body> </html> Connection closed by foreign host. =============================================================== This makes the browser not interpreting it as html and generating a file save dialog instead, although the script has already been executed and the script generates the text/html content-type line. How can I make apache use the content-type line generated by my script instead just like the case for Perl? |
|||
| Google The UNIX and Linux Forums |