crontabs

This is a discussion on crontabs within the Server Management forums, part of the Website Management category; Looks like I'm hogging this forum section, but I have another question!! I'm trying to set up a cron job ...


Reply
 
LinkBack Thread Tools Display Modes
Old 13th July 2010, 03:43 PM   #1
Member
 
stu2000's Avatar
 
Join Date: Jan 2009
Posts: 357
Thanks: 27
Thanked 26 Times in 25 Posts
stu2000 will become famous soon enough
Expertise: PHP
Experience: Professional
Send a message via Skype™ to stu2000
Default crontabs

Looks like I'm hogging this forum section, but I have another question!!

I'm trying to set up a cron job to run every 5 minutes. The server this is running on has no GUI (which is what I'm used to!) so for the first time I'm doing this through SSH.

I was wondering if this is the correct syntax to use in the file after running 'crontab -e'. Well... it's not working, so I assume it's wrong... I guess I'm more asking why it's wrong! lol:

Code:
*/5 * * * * /path/to/file/foo.php 
any advice would be greatly appreciated!

Thanks!

Stu
stu2000 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!twitter
Reply With Quote
Old 13th July 2010, 04:07 PM   #2
Tom
trusted
 
Tom's Avatar
 
Join Date: Jan 2009
Posts: 783
Blog Entries: 16
Thanks: 17
Thanked 35 Times in 35 Posts
Tom will become famous soon enoughTom will become famous soon enough
Expertise: Design & Graphics
Experience: Quite Good
Default

have you ran:

/path/to/file/foo.php

from the ssh terminal? it will probably not give any output as you are not telling it to do anything.

you need to run the file through php, so it should be:

php /path/to/file/foo.php
Tom is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!twitter
Reply With Quote
The Following User Says Thank You to Tom For This Useful Post:
stu2000 (13th July 2010)
Old 13th July 2010, 04:24 PM   #3
Member
 
stu2000's Avatar
 
Join Date: Jan 2009
Posts: 357
Thanks: 27
Thanked 26 Times in 25 Posts
stu2000 will become famous soon enough
Expertise: PHP
Experience: Professional
Send a message via Skype™ to stu2000
Default

Thank you! ... long day, I know you have to run it as a php file... so why didn't I? lol Because I'm an idiot that's why... hmmm

Right, the problem now is I think I don't have the right path. Which I'll have to get onto these hosts about.

Also, I can only run it if I'm in the same directory the as the actual script. e.g. if the script 'bar.php' in:

/htdocs/foo/

and I'm in 'htdocs', I can't run:

Code:
php /foo/bar.php 
I have to navigate to:

Code:
cd /htdocs/foo
So that I'm in the correct directory. Is that correct?

I'm starting to question my intelligence now lol!
stu2000 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!twitter
Reply With Quote
Old 13th July 2010, 04:35 PM   #4
Member
 
stu2000's Avatar
 
Join Date: Jan 2009
Posts: 357
Thanks: 27
Thanked 26 Times in 25 Posts
stu2000 will become famous soon enough
Expertise: PHP
Experience: Professional
Send a message via Skype™ to stu2000
Default

Cancel that, it is working!

Thanks a lot mate, sometimes it's the most obvious thing you miss...

...well I talk for myself there, it's always the most obvious thing with me lol!

Last edited by stu2000; 13th July 2010 at 04:37 PM..
stu2000 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!twitter
Reply With Quote
Old 14th July 2010, 08:01 AM   #5
Tom
trusted
 
Tom's Avatar
 
Join Date: Jan 2009
Posts: 783
Blog Entries: 16
Thanks: 17
Thanked 35 Times in 35 Posts
Tom will become famous soon enoughTom will become famous soon enough
Expertise: Design & Graphics
Experience: Quite Good
Default

what was the issue with the directories?

I spent 20 minutes looking at a domain the other day because DNS wasnt working for it, didnt think to check what name servers it was on and wasted my time looking at the wrong things... it was just one of those days :D
Tom is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!twitter
Reply With Quote
Old 14th July 2010, 08:40 AM   #6
Member
 
stu2000's Avatar
 
Join Date: Jan 2009
Posts: 357
Thanks: 27
Thanked 26 Times in 25 Posts
stu2000 will become famous soon enough
Expertise: PHP
Experience: Professional
Send a message via Skype™ to stu2000
Default

yeah, tell me about it! ta for the help tho, directory problem wasn't a problem, I was just finishing my day having another "moment" lol
stu2000 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!twitter
Reply With Quote
Reply

Tags
crontabs, ssh

« .htaccess issue | - »
Thread Tools
Display Modes