 |
 |
Cron paths
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2008
Status:
Offline
|
|
I am sure this is very simple.
I have a script at
http://localhost:8888/process/testing/onetime.php
I want it to run as a cron job.
10 1 * * * /usr/bin/wget -q localhost:8888/process/testing/onetime.php
What is wrong with this.
Is there some path info missing or something else  
Thanks
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Offline
|
|
well, for starters it needs the http:// in front of localhost. I doubt that you have wget installed in /usr/bin, this is the Linux install path. Are you doing this on a Linux box? What happens when you run that command manually?
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2008
Status:
Offline
|
|
i have tried with http:// and failed but i haven't installed wget. How is that done?
I am on os x tiger ibook. Also I am using Mamp so directories are in Applications if that messes things up.
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Offline
|
|
Why are you doing it that way anyway? Why not just execute it via the command line PHP interpreter?
what happens when you:
php /web/server/path/process/testing/onetime.php
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2008
Status:
Offline
|
|
I need it to recur. Maybe onetime isn't such a good file name. it was at the time!
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Offline
|
|
I know you need it to recur, you can put that command in your crontab.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2008
Status:
Offline
|
|
So this what is in my crontab:
Code:
# minute hour mday month wday who command
48 * * * * /usr/bin/php Applications/Mamp/htdocs/process/testing/onetime.php
I am changing the minute each time i try.
Something must be wrong with the syntax or Tiger now doesn't support it.
Should be a newline after command
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Offline
|
|
The Applications needs a leading slash, but I think there might be a gap in your understanding...
All cron does is executes a particular command at a particular time interval. If that same command (/usr/bin/php Applications/Mamp/htdocs/process/testing/onetime.php) doesn't produce the desired output when invoked in the command line manually, it is not going to work as a cronjob.
So, again, what happens when you invoke it manually? There is no point in worrying about your cronjob if the command does not even work properly.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2008
Status:
Offline
|
|
ok this has now worked from the command line
Code:
curl http://localhost/process/testing/onetime.php
this did not work in the crontab
Code:
49 * * * * curl http://localhost/process/testing/onetime.php
do i need to add a user?
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Offline
|
|
No, my guess would be that your cronjob doesn't know the path to your curl command. Do a:
which curl
in your terminal and paste in the full path name to your cronjob, replacing "curl". Then shortly before the cronjob is to run, do a:
tail -f /var/log/system.log
in your Terminal, or else watch this output in your Console app (inside your Utilities folder). The object here is to look for whether or not your cronjob is dying because of a particular error. If it is, this error should be logged. Let me know if this is generating an error.
It is likely that adding the full path will get this working for you though. I have no idea what executing onetime.php is supposed to do, and why it needs the overhead of curl or wget rather than just executing it via the command line PHP interpreter, but whatever works...
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2008
Status:
Offline
|
|
This is what came in the Terminal
bob:/private/etc Bob$ tail -f /var/log/system.log
May 19 09:38:02 bob cp: error processing extended attributes: Operation not permitted
May 19 04:08:03 bob postfix/postqueue[541]: warning: Mail system is down -- accessing queue directly
May 19 09:38:03 bob cp: error processing extended attributes: Operation not permitted
May 19 09:47:14 bob sudo: Bob : TTY=ttyp1 ; PWD=/private/etc ; USER=root ; COMMAND=/usr/bin/nano crontab
May 19 10:13:31 bob sudo: Bob : TTY=ttyp1 ; PWD=/private/etc ; USER=root ; COMMAND=/usr/bin/nano crontab
May 19 10:22:03 bob sudo: Bob : TTY=ttyp1 ; PWD=/private/etc ; USER=root ; COMMAND=/usr/bin/nano crontab
May 19 10:24:28 bob sudo: Bob : TTY=ttyp1 ; PWD=/private/etc ; USER=root ; COMMAND=/usr/bin/nano crontab
May 19 10:28:28 bob sudo: Bob : TTY=ttyp1 ; PWD=/private/etc ; USER=root ; COMMAND=/usr/bin/nano crontab
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2008
Status:
Offline
|
|
the onetime file is generating thumbnails on my local server. i would be setting it fro regularly once i can get it to work. Slows down my site to do it on the fly
Hope that helps understand my situation
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Offline
|
|
What time did your cronjob run? Anything that corresponds with those timestamps? Did it execute properly this time now that you added the full path to curl?
Once you get this to work, I would experiment with:
/path/to/php /path/to/process/testing/onetime.php
less overhead that way.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2008
Status:
Offline
|
|
it did not execute even with the path to curl
Thsoe timestamps look like each of my attempts to get it to run
Also this doesn't work in the terminal
bob:/private/etc Bob$ /usr/bin/curl http://localhost/process/testing/onetime.php
curl: (7) couldn't connect to host
(Last edited by beedie; May 19, 2008 at 12:30 AM.
(Reason:update))
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2008
Status:
Offline
|
|
Actually this does work
Code:
bob:/private/etc Bob$ /usr/bin/curl http://localhost:8888/process/testing/onetime.php
from the command line.
Thank you again for all your patience
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2008
Status:
Offline
|
|
rebuilding cron was never done
crontab /etc/crontab
was all that was needed.
Thanks for all your suggestions
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|