LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   crontab not executing command (https://www.linuxquestions.org/questions/linux-newbie-8/crontab-not-executing-command-4175421838/)

figure20012 08-13-2012 06:06 AM

crontab not executing command
 
i have placed the following line in the crontab file
crontab -e

and then
in the crontab file
57 14 * * * ls /home

ted_chou12 08-13-2012 07:10 AM

not sure what dist u have, can you post the output of "crontab -l" and show us your etc directory?

suicidaleggroll 08-13-2012 08:41 AM

How do you know it's not running?

lleb 08-13-2012 11:35 AM

Quote:

Originally Posted by figure20012 (Post 4753019)
i have placed the following line in the crontab file
crontab -e

and then
in the crontab file
57 14 * * * ls /home

that will not display anything on your screen. you can check to see if is running by looking in /var/log/cron/

you can edit that file as root and look for the 2:57pm time stamp. it will show you there if it ran.

Lythix1 08-13-2012 12:05 PM

I think you're supposed to redirect the output somewhere. Try the following entry instead

57 14 * * * ls /home >> home.log

Then when you open home.log you will see the output of this command.

figure20012 08-15-2012 10:44 AM

can i redirect the output to my terminal ?

Lythix1 08-15-2012 10:49 AM

I don't think so off the top of my head. I think the Crontab Deamon sort of acts like its own session so you wouldn't see it just as if you wouldn't see the output of another user logged in at the same time as you running the command. Is there a reason you don't want it directed to a file? In all my servers I direct output to log files (half the reason i love linux)

michaelk 08-15-2012 01:07 PM

It is possible to run GUI apps if you tell cron to use a display. Assuming you are running a desktop the general command is:

57 14 * * * DISPLAY=:0.0 /my/GUI/app

Is this a homework problem?


All times are GMT -5. The time now is 07:55 PM.