PDA

View Full Version : [all variants] "echo" command in Crontab



Xafer
May 25th, 2010, 01:43 AM
Hi there, I just setup a cron that display a message like : "hello world" for every minutes. So I put this:

* * * * * echo "hello world"

And then I waited and stare at terminal.
But seems like it doesnt shown off, did I messed up something?

Xafer
May 25th, 2010, 10:09 AM
I also tried to put the echo command on some .sh script, so the crontab :

* * * * * sh test.sh

but still not working

a-user
May 25th, 2010, 11:54 AM
as far as i know there is no way to do this. in fact echo is correct but there is no terminal output connected to the process when it gets executed. hence no output to be seen.

demons have no stdout and thus never can print messages. you may redirect the output to a file and look into that file.

try something like:
* * * * * echo "hello world" > /home/myuser/test.out

where myuser is your users name. but its probably better to put the exho command into a shell script file.