iamsteve has asked for the wisdom of the Perl Monks concerning the following question:

Is there a way to have a CGI script run every 24 hours by itself without me or anyone actually clicking or running it manually. (e.g. Automated script) I checked search but found nothing. I wanted to make sure of my answer. Also does anyone have a recommendation for automated scripts that needs to run once every 24 hours

Replies are listed 'Best First'.
Re: Automated Script, scripting
by Juerd (Abbot) on Dec 31, 2001 at 04:36 UTC
    Having a CGI run automatically makes absolutely no sense.
    CGI is for web-based applications. Perl just happens to be one of the many languages suited for creating CGI applications.

    Perl isn't just a CGI language. It's a programming language that can be used for many purposes, including system administration. As long as scripts are non-interactive, they can be run with cron. Cron is installed on most *nix systems. If you use Windows, use one of the many available schedulers.
    If for some reason (I can't think of any) you need to run a CGI script, just have a browser download it and exit (e.g. links -dump or perl -MLWP::Simple -e'get "..."'.

    2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

      Your CGI vs. Perl thing is absolutely correct... I just wanted to add that you should also look at "at", which is also available (eaisly) for NT.

      Thanks,
      James Mastros,
      Just Another Perl Scribe

Re: Automated Script, scripting
by cLive ;-) (Prior) on Dec 31, 2001 at 07:08 UTC
    crontab on *nix.

    And not to poo-poo the correct answers above, but you could crontab a Perl script to use LWP::UserAgent to run a CGI script every 24hrs, but that's just me being picky :)

    cLive ;-)

    (well, I *am* on vacation here - plft)