Gossamer Forum
Home : Products : Links 2.0 : Customization :

Alternative to Cron

Quote Reply
Alternative to Cron
Hi,

I need an alternative to cron to run a script quite often. I figure everytime search.cgi runs would be good. It's a low power script that refreshes news headlines (nothing like the auto build that was discussed). I just want to make sure that it runs in the background and doesn't slow down the search for the user at all.

Any ideas how I can have search.cgi run a file.sh?

Thanks,
Adam

Quote Reply
Re: Alternative to Cron In reply to
There are a few "alternative" scheduling programs to Cron, but they are formatted for Windows servers. Search the following web sites:

http://www.perlarchive.com
http://www.cgi-resources.com
http://www.hotscripts.com

Regards,

Eliot Lee
Quote Reply
Re: Alternative to Cron In reply to
Hi!
I'm sorry, I can't find my perl-book at the moment, but you can execute a shell-command or shell-script from a perl-programm by

Code:
system('/the/script.sh');
(This will start the script, and wait, till it is ended, before it continues your perl-script.)

or
Code:
exec "/your/script.sh";
(This will terminate your perl-script, and will start your shell-script!)

But I'm afraid, both of them aren't right, because you don't want your search-script terminated or waiting for your shell-script to terminate. But perhabs you may use exec ... as last command of your search.cgi?

Better you ask a real perl-guru!

Just my 2 cents....

Bye
Tiggr

Quote Reply
Re: Alternative to Cron In reply to
Right...you could use the system command, but as mentioned a few times in these support forums...that is a dangerous command to use in cgi scripts, which could be accessed and executed by anyone...read the Thread in the Perl/CGI forum where the sytem command is discussed by Alex and Mark.

Good luck!

Regards,

Eliot Lee
Quote Reply
Re: Alternative to Cron In reply to
Hi!

>that is a dangerous command to use in cgi scripts, which
>could be accessed and executed by anyone

I'm using it only inside nph-build in a .htaccess-protected directory. So I think it shouldn't do any harm.

I'm not shure, but I think, it want be dangerous, if I use it only in a way like
Code:
system('~/bin/somescript.sh');
without passing any parameters to it?

(Perhabs followups should be posted in the "Perl and CGI"-Board)

Bye and thanks
Tiggr