The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 16, 2019, 01:33:02 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: crontab  (Read 2619 times)
NYDAz
Expert
****
Offline Offline

Posts: 212

The Night Stalker


View Profile
« on: November 16, 2009, 02:45:22 PM »

I don't know much about cron jobs but I think I've got it !

if I load a crontab, does it remain in computer's memory or do I need it to run it every time I power on the computer ?

    

<later edit>

Seems like my crontab won't start !

Any help is appreciated !

- I've created a script example.php and put it on my desktop
- opened terminal
- checked my crontab with : nydaz@nydaz ~ $ crontab -l
- no crontab for nydaz
- created a file nydaz.cron with the following content :
# m h  dom mon dow   command
25 0 * * * php /home/nydaz/Desktop/example.php
- i want it to run everyday at 0:25
- executed from terminal with nydaz@nydaz ~ $ crontab /home/nydaz/Desktop/nydaz.cron
- it won't start

what should I do ?

Shocked

</later edit>
« Last Edit: November 16, 2009, 03:10:40 PM by NYDAz » Logged

what's up?
serialnoob
Journeyman
***
Offline Offline

Posts: 88


View Profile
« Reply #1 on: November 16, 2009, 04:53:18 PM »

not brilliant at that either but this is one of mine (in spirit) that works;

php -q /home/user/bla/bla/script_to_run.php 1>/dev/null 2>&1

"1>/dev/null 2>&1" this part includes whether or not to email result display it (in this case show or email nothing), but if you google it specificaly, it should get you going
Logged

Success consists of going from failure to failure without loss of enthusiasm - Winston Churchill
Bompa
Administrator
Lifer
*****
Offline Offline

Posts: 564


Where does this show?


View Profile
« Reply #2 on: November 16, 2009, 05:02:14 PM »

Desktop?  What OS is this?

I'm confused.
Logged

"The most beautiful and profound emotion we can experience is the sensation of the mystical..." - Albert Einstein
NYDAz
Expert
****
Offline Offline

Posts: 212

The Night Stalker


View Profile
« Reply #3 on: November 16, 2009, 05:16:03 PM »

oooppsy !

I forgot to export the results into a txt file !

I thought that the crontab will show me when it's working !

 ROFLMAO

Desktop?  What OS is this?

I'm confused.


linux mint on desktop

not brilliant at that either but this is one of mine (in spirit) that works;

php -q /home/user/bla/bla/script_to_run.php 1>/dev/null 2>&1

"1>/dev/null 2>&1" this part includes whether or not to email result display it (in this case show or email nothing), but if you google it specificaly, it should get you going
thanks bro !

the correct syntax is :
25 0 * * * /usr/bin/php /home/nydaz/Desktop/example.php > /tmp/results.txt

Finally !
 D'oh!
Logged

what's up?
serialnoob
Journeyman
***
Offline Offline

Posts: 88


View Profile
« Reply #4 on: November 19, 2009, 11:19:55 AM »

the correct syntax is :
25 0 * * * /usr/bin/php /home/nydaz/Desktop/example.php > /tmp/results.txt

Finally !
 D'oh!

welcome!

Glad to learn about yr /tmp/results.txt

I assume 'results.txt' ends up in '/home/nydaz/tmp/results.txt' Right?
Logged

Success consists of going from failure to failure without loss of enthusiasm - Winston Churchill
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!