oh sorry or change the sh script to
cd /root
./test > /dev/tty
that will be easier :)
Main Topics
Browse All TopicsHi Guru:
I have application. I would like to output the debug infomation on my console or any terminal or stdout. I can run the application to do this. I also can run a script which starts the application without problem. But If I put the script on crontab to run it, I can't get output. I don't know where it goes.
for instance,
crontab like: * * * * * /root/check.sh
check.sh:
#!/bin/sh
cd /root
./test
test.cpp:
#include <stdio.h>
int main() {
while(1) {
printf("test.........\n");
}
return 0;
}
gcc -o test test.cpp
If I run "test" alonely, I can see output from screen like:
test.....
test....
If I run check.sh alonely, it does the same thing.
But if it run from cron, I can't see any output. printf says that it outputs the info to stdout, but where the output goes. I really need to get
those info from console but not redirect to file since we don't have much space. How can I get this. This is just a simple example. Thanks for help.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
When executing commands, any output is mailed to the owner
of the crontab (or to the user named in the MAILTO environment variable in the crontab, if such exists).
for all messages upto now check you mail box
if you are connecting to the machine remotely then you can use /dev/console for seeing your output as g3gg0 pointed out
but i do not think that you can use /dev/tty
/dev/tty refers to the your terminal on which you are working ... and it is not associated with cron
It works with /dev/console. But I got lots of messages in the mailbox like sunnycoder said. I don't want that since the mailbox would be growing and eventually take away my space. I tried to stop sendmail, didn't work, then realized that it used local mail (I guess). Is any way to stop that (disable this from somewhere). Thanks for help.
Business Accounts
Answer for Membership
by: g3gg0Posted on 2003-06-26 at 16:04:13ID: 8809364
try to open ( "/dev/tty", ... )
and write there ;)
good luck :)