Step 1: Install a HTTP server
Step 2: Configure the server to handle certain files in a certain directory as CGI scripts.
Step 3: Add a <form>
to your page that POST
s to a CGI script. Include a submit
button. This isn't really a web-appy thing, running scripts on servers is ancient. See the guestbooks and counter-images of 90s webpages.
The script itself would look something like (in Perl):
#!/usr/bin/perl
use CGI;
# the following line is *strongly* recommended
use strict; use warnings; use CGI::Carp qw(fatalsToBrowser);
my $cgi = CGI->new();
print $cgi->header();
exec "/usr/bin/script-I-want-to-run", "--switch", "value";
In Bash this might work:
#!/bin/sh
echo "Content-type: text/plain"
echo ""
/usr/bin/script-or-whatever --switch value
Perl's CGI module will even help you with getting $cgi->param
eters and stuff and can be absolutely recommended. You will find a lot of (mostly bad) tutorials on Perl CGI scripting in the interwebs when you ask Google. Read them anyway.