LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 08-13-2012, 06:06 AM   #1
figure20012
Member
 
Registered: Apr 2012
Posts: 75

Rep: Reputation: Disabled
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
 
Old 08-13-2012, 07:10 AM   #2
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 431
Blog Entries: 32

Rep: Reputation: 3
not sure what dist u have, can you post the output of "crontab -l" and show us your etc directory?
 
Old 08-13-2012, 08:41 AM   #3
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
How do you know it's not running?
 
Old 08-13-2012, 11:35 AM   #4
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Quote:
Originally Posted by figure20012 View Post
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.
 
Old 08-13-2012, 12:05 PM   #5
Lythix1
LQ Newbie
 
Registered: Aug 2012
Posts: 2

Rep: Reputation: Disabled
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.
 
1 members found this post helpful.
Old 08-15-2012, 10:44 AM   #6
figure20012
Member
 
Registered: Apr 2012
Posts: 75

Original Poster
Rep: Reputation: Disabled
can i redirect the output to my terminal ?
 
Old 08-15-2012, 10:49 AM   #7
Lythix1
LQ Newbie
 
Registered: Aug 2012
Posts: 2

Rep: Reputation: Disabled
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)
 
2 members found this post helpful.
Old 08-15-2012, 01:07 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,759

Rep: Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931
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?
 
1 members found this post helpful.
  


Reply

Tags
cron



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
[SOLVED] Crontab not executing shell when date is added Jakkie Linux - Newbie 14 02-15-2012 05:18 AM
[SOLVED] Crontab not executing specific script abdoullah Linux - General 3 06-17-2011 02:15 PM
Seems crontab is not executing script... jonaskellens Linux - Newbie 3 11-18-2010 08:20 AM
crontab job not executing.... mia_tech Linux - Newbie 6 08-31-2009 02:42 PM
Command for executing C program in crontab bhandu Linux - Newbie 1 07-14-2007 12:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:58 AM.

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