Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 07-10-2005, 03:20 PM   #1
Registered: Oct 2004
Posts: 84

Rep: Reputation: 15
Help with cron

I would like my cron-job output in a log file and made this test-script:
echo I'm a git
and with:
# sh
I get the right output, but when I try to make it a cron-job nothing happen:
01 * * * * /root/>>/logs/test.log>/dev/null 2>&1
I don't want any emails, I just want the output of to be written at the end of test.log....

It won't work - what am I doing wrong?

test.log exists and root has rwx to the file...

Old 07-10-2005, 03:25 PM   #2
LQ Guru
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 252Reputation: 252Reputation: 252
root might have rwx to the file as a user but is the file executable? Does it work from a command line without specifying its a sh script?

chmod +x
Old 07-10-2005, 03:39 PM   #3
Registered: Oct 2004
Posts: 84

Original Poster
Rep: Reputation: 15
-rwx--x--x  1 root root    0 Jul 10 20:34 test.log

-rwxr-xr-x   1 root root   42 Jul 10 21:01

Last edited by @ngelot; 07-10-2005 at 03:41 PM.
Old 07-10-2005, 04:08 PM   #4
Registered: Oct 2004
Posts: 84

Original Poster
Rep: Reputation: 15
Found it out my self - I didn't understand the difference between output 1 and 2.

This is the correct way:

10 * * * * /root/ 1>/logs/test.log 2>&1

as in 1 (if OK) then print output in test.log and 2 (if not OK) do the same....

Old 07-11-2005, 05:18 AM   #5
Senior Member
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
as in 1 (if OK) then print output in test.log and 2 (if not OK) do the same....
Hmm, i guess that's right. But to be more exact:

1= standard output
2= standard error

Those are what the numbers mean.



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
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 09:09 AM
cron.allow and cron.deny in slackware? tl64 Slackware 5 10-13-2005 10:44 PM
No More Cron Mail, Cron Error? Xhost Linux - General 3 07-26-2004 05:28 PM
[cron][mdk9.1]cron deamon seems to ignore some task... yannrichet Linux - Newbie 5 06-26-2003 10:57 AM
dual entries in cron log for cron.daily cpharvey Linux - General 3 02-27-2003 03:30 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:06 PM.

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