LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (https://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   cronjob problem (https://www.linuxquestions.org/questions/linux-enterprise-47/cronjob-problem-627125/)

manoj.linux 03-11-2008 12:24 AM

cronjob problem
 
Hi,

I am not getting output of ls command Ihave schdule cron job,I have used following command for user test, I want every 2 min ls command should be executed.

02 * * * * /usr/bin/ls > /home/test/ls.txt

Berhanie 03-11-2008 01:42 AM

Code:

*/2 * * * * /usr/bin/ls > /home/test/ls.txt

manoj.linux 03-11-2008 03:28 AM

Quote:

Originally Posted by Berhanie (Post 3084682)
Code:

*/2 * * * * /usr/bin/ls > /home/test/ls.txt

Thanks but still the file ls.txt is not creating, can u give me some idea

billymayday 03-11-2008 03:30 AM

Why don't you try something like

Code:

*/2 * * * * /usr/bin/ls /home > /home/test/ls.txt

billymayday 03-11-2008 03:35 AM

Actually, does /usr/bin/ls exist or is it an inate system command?

Code:

*/2 * * * * ls /home > /home/ls.txt
works for me, whereas the version I posted previously produces a zero length file

Berhanie 03-11-2008 09:39 AM

Quote:

Thanks but still the file ls.txt is not creating
It may be because the cron process didn't have permission to create the file (e.g. /home/test/ doesn't exist, or has the wrong permissions). Only the logs will tell you for sure. Check /var/log/cron and read your email for any messages from cron.

manoj.linux 03-11-2008 11:40 PM

Quote:

Originally Posted by Berhanie (Post 3085125)
It may be because the cron process didn't have permission to create the file (e.g. /home/test/ doesn't exist, or has the wrong permissions). Only the logs will tell you for sure. Check /var/log/cron and read your email for any messages from cron.

Thanks Berhanie, I have done the necessary changes,Now file is creating.

sixty_nine 03-17-2008 11:52 AM

for non-working cron job always watch the log file.
The default log file for cron job is /var/log/cron


All times are GMT -5. The time now is 06:18 AM.