|
|
#1 |
|
Prospect
Join Date: Jan 2002
Posts: 9
|
Mac OS X 10.1.5, PowerMac G4
I'm running Apache (1.3.26) and PHP (4.2.2) as an Apache module, and I'd like to set some php scripts to run at certain times of the day. I've done some research, and the recommended way to do this when php is installed as a module is to set a task in my crontab that uses Lynx (or cURL, etc.) to hit the page at a specified time. I added the task to my crontab, but it's not working. I can run the command at the command line and it works, but it won't run via cron. I'm editing my crontab with 'crontab -e'. The line I inserted is: 45 10 * * * root curl -s http://myserver.com/path/to/script.php > /dev/null I understand this to mean that at 10:45am by the machine's clock, it runs 'curl -s http://myserver.com/path/to/script.php > /dev/null' as root. However, it doesn't do it. I've also tried it using other users, as well. I can run 'curl -s http://myserver.com/path/to/script.php > /dev/null' from the command line and it works. I've also tried it with 'lynx -dump http://myserver.com/path/to/script.php > /dev/null', but still no go. Any ideas? Thanks! Steven |
|
|
|
|
|
#2 |
|
Major Leaguer
Join Date: May 2002
Location: Sweden
Posts: 282
|
You say you have added it to "your" crontab. I seem to recall that there are different formats on user crontabs and root's crontab. The user field is the difference. It should be there for roots crontab and left out for plain users. Thus:
45 10 * * * curl -s http://myserver.com/path/to/script.php > /dev/null Might work.
__________________
/PEZ |
|
|
|
|
|
#3 |
|
Major Leaguer
Join Date: May 2002
Location: Sweden
Posts: 282
|
And. I'm curious as to what that script does. Seems like a long way to go via the webbserver to get the job done. Can you share some details?
__________________
/PEZ |
|
|
|
|
|
#4 |
|
Prospect
Join Date: Jan 2002
Posts: 9
|
I'll try that tip above (haven't had a chance to try it yet).
The script opens a tab-delimited text file, parses the content, and stores it in a MySQL database each day to update some content on our website. |
|
|
|
|
|
#5 |
|
Prospect
Join Date: Jan 2002
Posts: 9
|
I forgot to address the user/root crontab issue. I *think* it's using the system crontab at /private/etc/crontab.
Where is the user crontab stored? |
|
|
|
|
|
#6 |
|
Major Leaguer
Join Date: Jan 2002
Location: Adelaide, South Australia
Posts: 470
|
The "installed" user crontabs sit in
/var/cron/tabs (=/private/var/cron/tabs), but you wouldn't dream of touching them in situ now, would you?! The files in question are emblazoned with the warning: # DO NOT EDIT THIS FILE - edit the master and reinstall. Cheers, Paul |
|
|
|
|
|
#7 |
|
Prospect
Join Date: Jan 2002
Location: Indianapolis
Posts: 34
|
When using crontab, you need to give the /full/path/to/command .
In this case, curl should be /usr/bin/curl Good luck! August |
|
|
|
![]() |
|
|