Go Back   The macosxhints Forums > OS X Help Requests > UNIX - Newcomers



Reply
 
Thread Tools Rate Thread Display Modes
Old 08-28-2002, 11:46 AM   #1
sjarvis
Prospect
 
Join Date: Jan 2002
Posts: 9
10.1 trouble with crontab

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
sjarvis is offline   Reply With Quote
Old 08-28-2002, 12:31 PM   #2
osxpez
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
osxpez is offline   Reply With Quote
Old 08-28-2002, 12:32 PM   #3
osxpez
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
osxpez is offline   Reply With Quote
Old 08-28-2002, 02:33 PM   #4
sjarvis
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.
sjarvis is offline   Reply With Quote
Old 08-28-2002, 02:42 PM   #5
sjarvis
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?
sjarvis is offline   Reply With Quote
Old 08-30-2002, 11:32 AM   #6
pmccann
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
pmccann is offline   Reply With Quote
Old 09-11-2002, 08:07 AM   #7
BlueGus
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
BlueGus is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 06:12 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.