August 19th, 2000, 11:34 AM
I'd written a script to get stock values from some site and put them onto a mySQL Database every minute or so. the script works fine except that I have to ssh to my server at phpwebhosting.com in order to have it running. is there a way to configure it such that it runs automatically everyday or so?
August 19th, 2000, 12:50 PM
Run a crontab. Make a file called crons.txt (or whatever you want it to be) and put this line in it:
1 * * * * perl /full/path/to/script.pl
then at the command prompt type this:
This will setup your crontab for the info in crons.txt.
Now the system will "perl /full/path/to/script.pl" every minute"
August 19th, 2000, 02:31 PM
Thanks so much.
Few more questions. How do I know if my service provider is running cron the daemon? and I tried it with a simple perl script to print something out but it doesn't do anything after long wait. what should I do?
August 19th, 2000, 04:20 PM
PHP Web Hosting allows you to run crons. (I know this from experience). The only way to check it is to have it e-mail you something, it wont print anything to the screen. Just setup a simple e-mail program and set it in the crontab.
P.S. You can type "crontab -l" at the command prompt to see your current crons.
August 19th, 2000, 04:26 PM
Thanks so much. So the idea of having the program to update a mysql database should work from what I understand?
August 19th, 2000, 05:47 PM
my script has not been working. Can you check with me if I have the crontab configuration correct?
my user name in phpwebhosting is moliu.
* * * * * perl /home2/moliu/cgi-bin/test.pl
should I use quotation or something like that?
August 20th, 2000, 02:29 PM
I don't think that the server will let you put * * * * *. This would run every second.. that's not something the server wants you to do.
No, you don't need quotes.