LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-29-2009, 07:39 PM   #1
CosmicSea
LQ Newbie
 
Registered: Oct 2009
Posts: 14

Rep: Reputation: 0
Cron Help Please.


I dont know why my script wont run. I have tried several solutions and im thinking maybe its the script? I know cron is working cause i used a script to make a new text document every minute and that worked and i dont know what to do. i need some help.
im trying to get it to run every hour but first i need to get it going. is there a way i can execute the php file myself to make sure it works? i use ubuntu 8.04.

NEVERMIND. SOLVED! THANKS ANYWAY

Last edited by CosmicSea; 10-29-2009 at 07:43 PM.
 
Old 10-29-2009, 08:03 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,361
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
Quote:
Originally Posted by CosmicSea View Post
NEVERMIND. SOLVED!
Please be so kind as to post problem and solution details as it may help others.
 
Old 10-31-2009, 04:07 AM   #3
CosmicSea
LQ Newbie
 
Registered: Oct 2009
Posts: 14

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
Please be so kind as to post problem and solution details as it may help others.
i will i just dont have this problem fixed yet.
 
Old 10-31-2009, 04:16 AM   #4
CosmicSea
LQ Newbie
 
Registered: Oct 2009
Posts: 14

Original Poster
Rep: Reputation: 0
i still cannot get my cron to work. does anyone else have any suggestions?
 
Old 10-31-2009, 04:40 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,361
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
So why did you edit your OP to add "NEVERMIND. SOLVED! THANKS ANYWAY"?

Posting the script and execution details of the cronjob you're trying to run may help. Also check your (or root) email address as errors by default will be sent to the owner of the crontab.

Last edited by unSpawn; 10-31-2009 at 04:52 AM.
 
Old 10-31-2009, 05:17 AM   #6
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Please be aware that cron has a limited PATH.
So try to use the whole path to all the commands and files in the script.
 
Old 10-31-2009, 07:23 AM   #7
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,093

Rep: Reputation: 197Reputation: 197
Quote:
Originally Posted by CosmicSea View Post
NEVERMIND. SOLVED! THANKS ANYWAY
Quote:
Originally Posted by CosmicSea View Post
i will i just dont have this problem fixed yet.
You hurt the logic centre of my brain a little.


Anyway, I think maybe this is the sentence that explains your problem:

Quote:
Originally Posted by CosmicSea View Post
is there a way i can execute the php file myself to make sure it works? i use ubuntu 8.04.
The way you'd run the php script from cron is exactly the same as you're run it yourself to test it. Since you apparently don't know how to run the php script to test it then I suspect that you're not calling it correctly from the crontab.

To test the file yourself use

Code:
$ php file.php
You use the same thing in the crontab

Code:
00 * * * *  php /path/to/file.php

However if file.php makes reference to other files it needs to access using relative paths, as is the case in php script I set up to be run from cron the other day I'd use


Code:
00 * * * * cd /path/to && php file.php
Using cd first makes sure file.php could find those other files. If file.php If file.php used absolute paths for the other files it wouldn't be a problem.

I may be wrong of course. If I am post relevant stuff as unSpawn suggests.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cron.hourly cron.weekly cron.monthly and 0anacron. Are they necessary? glore2002 Debian 2 09-30-2009 09:57 PM
Cron appears to be messed up (E: cron: subprocess post-installation script returned e bujutsukai Linux - Newbie 1 07-24-2008 04:39 AM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 09:16 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 02:57 AM
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there. mavinashbabu Linux - Newbie 4 09-21-2006 02:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration