LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cron question (https://www.linuxquestions.org/questions/linux-newbie-8/cron-question-773074/)

igxz 12-02-2009 07:46 PM

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

Tinkster 12-02-2009 07:54 PM

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


Cheers,
Tink

igxz 12-02-2009 08:06 PM

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 (Post 3777810)
Because each shell, including crons, has its OWN STDOUT, which, in crons
case, isn't attached to a terminal.


Cheers,
Tink


chrism01 12-02-2009 09:52 PM

You may want to try this http://linux.die.net/man/1/wall or http://linux.die.net/man/1/write

igxz 12-03-2009 02:27 PM

that would work! thanks

Quote:

Originally Posted by chrism01 (Post 3777886)


MTK358 12-03-2009 02:55 PM

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


All times are GMT -5. The time now is 09:57 AM.