Help with cron
I would like my cron-job output in a log file and made this test-script:
Code:
#!/bin/sh Code:
# sh test.sh Code:
01 * * * * /root/test.sh>>/logs/test.log>/dev/null 2>&1 It won't work - what am I doing wrong? test.log exists and root has rwx to the file... Thanks! |
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 test.sh |
Yep!
Code:
-rwx--x--x 1 root root 0 Jul 10 20:34 test.log Code:
-rwxr-xr-x 1 root root 42 Jul 10 21:01 test.sh |
Found it out my self - I didn't understand the difference between output 1 and 2.
This is the correct way: 10 * * * * /root/test.sh 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.... Thanks! |
Quote:
1= standard output 2= standard error Those are what the numbers mean. -twantrd |
All times are GMT -5. The time now is 12:44 PM. |