Cron

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
Kolin
Level 1
Level 1
Posts: 16
Joined: Sat Apr 28, 2012 2:39 am

Cron

Post by Kolin »

hi 2 all. I have one problem - I use laptop as web-server, for development (Mint 13 Maya). Here is some cron: "* * * * * php /home/user/webServer/test.php". And it doesnt work. But if I use "php /home/user/webServer/test.php" in the Terminal, it works perfect. I test it throught ssh. So, why cron dont work?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
xenopeek
Level 25
Level 25
Posts: 29597
Joined: Wed Jul 06, 2011 3:58 am

Re: Cron

Post by xenopeek »

Moving it here, as I think the users knowledgeable about cron are here.

Does php produce some logfile? Else you may want to wrap this in a small shell script to ensure you output any stderr or stdout output. Partial example of that is here http://forums.linuxmint.com/viewtopic.p ... 16#p481766.
Image
AlbertP
Level 16
Level 16
Posts: 6701
Joined: Sun Jan 30, 2011 12:38 pm
Location: Utrecht, The Netherlands

Re: Cron

Post by AlbertP »

In which file did you put that cron line?
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.
Kolin
Level 1
Level 1
Posts: 16
Joined: Sat Apr 28, 2012 2:39 am

Re: Cron

Post by Kolin »

AlbertP wrote:In which file did you put that cron line?
I use crontab -e
Kolin
Level 1
Level 1
Posts: 16
Joined: Sat Apr 28, 2012 2:39 am

Re: Cron

Post by Kolin »

xenopeek wrote:Moving it here, as I think the users knowledgeable about cron are here.

Does php produce some logfile? Else you may want to wrap this in a small shell script to ensure you output any stderr or stdout output. Partial example of that is here http://forums.linuxmint.com/viewtopic.p ... 16#p481766.
No log files. Connect to database, insert into valuses
AlbertP
Level 16
Level 16
Posts: 6701
Joined: Sun Jan 30, 2011 12:38 pm
Location: Utrecht, The Netherlands

Re: Cron

Post by AlbertP »

By default it indeed may not save things in a log file, but Vincent posted an how-to to save all the output of the terminal command to a file. Then you can find the output - maybe including an error - in the file.
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.
Kolin
Level 1
Level 1
Posts: 16
Joined: Sat Apr 28, 2012 2:39 am

Re: Cron

Post by Kolin »

AlbertP wrote:By default it indeed may not save things in a log file, but Vincent posted an how-to to save all the output of the terminal command to a file. Then you can find the output - maybe including an error - in the file.
not errors - I run it manually, script works.
AlbertP
Level 16
Level 16
Posts: 6701
Joined: Sun Jan 30, 2011 12:38 pm
Location: Utrecht, The Netherlands

Re: Cron

Post by AlbertP »

But maybe it does display an error when cron tries to run it. That's what the how-to of Vincent is for.
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.
Kolin
Level 1
Level 1
Posts: 16
Joined: Sat Apr 28, 2012 2:39 am

Re: Cron

Post by Kolin »

thanks, it works
Locked

Return to “Scripts & Bash”