LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 12-02-2009, 08:46 PM   #1
igxz
Member
 
Registered: Mar 2009
Distribution: Slackware 13.37 - Stable
Posts: 61

Rep: Reputation: 0
Question cron question


hi fellows,

I am newbie of cron, and I set following cron expression using crontab -e,

1-59 * * * * echo "THIS RUNS EVERY MINUTE TO STANDARD OUTPUT!"

but it was not printed out on standard output as I was expecting, I know it did run base on cron log says

----------------- tail of /var/log/cron ----------------------
Dec 3 14:42:01 bustest1 crond[302]: (root) RELOAD (cron/root)
Dec 3 14:42:01 bustest1 crond[1936]: (root) CMD (echo "THIS RUNS EVERY MINUTE TO STANDARD OUTPUT!")
--------------------------------------------------------------

just wondering why it didn't appear in standard output?

thanks in advance!

regards
Stephen Z

Last edited by igxz; 12-02-2009 at 09:04 PM.
 
Old 12-02-2009, 08:54 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Because each shell, including crons, has its OWN STDOUT, which, in crons
case, isn't attached to a terminal.


Cheers,
Tink
 
Old 12-02-2009, 09:06 PM   #3
igxz
Member
 
Registered: Mar 2009
Distribution: Slackware 13.37 - Stable
Posts: 61

Original Poster
Rep: Reputation: 0
thanks for your explanation Tink, so there is no way to echo anything to standard output, is there? thx


regards
Stephen Z

Quote:
Originally Posted by Tinkster View Post
Because each shell, including crons, has its OWN STDOUT, which, in crons
case, isn't attached to a terminal.


Cheers,
Tink
 
Old 12-02-2009, 10:52 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
You may want to try this http://linux.die.net/man/1/wall or http://linux.die.net/man/1/write
 
Old 12-03-2009, 03:27 PM   #5
igxz
Member
 
Registered: Mar 2009
Distribution: Slackware 13.37 - Stable
Posts: 61

Original Poster
Rep: Reputation: 0
that would work! thanks

Quote:
Originally Posted by chrism01 View Post
 
Old 12-03-2009, 03:55 PM   #6
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720
Try:

Code:
1-59 * * * * echo "Reminder: One minute has passed!" | wall
Or a funnier version (if you have cowsay):

Code:
1-59 * * * * cowsay "Reminder: One minute has passed!" | wall
 
  


Reply


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
cron.hourly cron.weekly cron.monthly and 0anacron. Are they necessary? glore2002 Debian 2 09-30-2009 09:57 PM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 09:16 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 02:57 AM
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there. mavinashbabu Linux - Newbie 4 09-21-2006 02:50 PM
cron question paperdiesel Linux - Newbie 2 10-29-2003 04:28 PM


All times are GMT -5. The time now is 03:13 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration