in reply to CGI Question - run external script and then update page

On the HTML side you will need a form and submit button to run the update script.

<form method="POST" action="http://somesite.com/cgi-bin/script.pl"> <input type="Submit" value="Update"> </form> # for the script #!/usr/bin/perl -w use CGI; use Fcntl qw(O_WRONLY O_CREAT O_EXCL); my $q = new CGI; my $lockfile = '/tmp/lock'; if (sysopen(FH, $lockfile, O_WRONLY | O_CREAT | O_EXCL)) { # sysopen will only work if lockfile does not exist # exec the script and wait for it to complete using bacticks or ex +ec `your_update_script`; close FH; unlink $lockfile or error("<h3>Can't unlink lockfile $lockfile $!< +h3>"); print $q->redirect('http://page_to_display_after_update'); } else { error("<h3>Update already in progress!</h3>"); exit; } sub error { print $q->header, shift; }

Note that there will be collisions with your cron job unless you write a similar short lockfile script and exec that from cron like:

#!/usr/bin/perl -w use Fcntl qw(O_WRONLY O_CREAT O_EXCL); my $lockfile = '/tmp/lock'; if (sysopen(FH, $lockfile, O_WRONLY | O_CREAT | O_EXCL)) { `your_update_script`; close FH; unlink $lockfile or die "Can't unlink lockfile $lockfile $!"; print "Updated"; } else { die "Update already in progress. Aborting!"; }

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print