Click to See Complete Forum and Search --> : running a bash script on loading a page
zatang90210
08-05-2003, 02:14 PM
Hi all:
I wanted to run a Unix command/bash script whenever a webpage is loaded (or alternatively a link is clicked). Whats the easiest way to do this and is there any sample code?
Thanks.
Jeff Mott
08-06-2003, 10:27 PM
You can execute a script whenever a page is requested with SSI (Server Side Include).<!--#include virtual="/path/to/script" -->...if you want the output of the script included in your page, otherwise<!--#exec cmd="/path/to/script" -->
zatang90210
08-07-2003, 10:35 AM
Sorry for being a novice, but can you just provide me an example of HTML code where this line needs to be inserted.
Does the script.sh have to be somewhere particular? Here's what my script is:
#!/usr/bin/perl
$title = "My First Perl Script";
print <<"(END HTML)";
Content-type: text/html
<HTML>
<HEAD>
<TITLE>$title</TITLE>
</HEAD>
<BODY BGCOLOR="white">
<CENTER>
<H2>$title</H2>
</CENTER>
</BODY>
</HTML>
(END HTML)
exit;