crontab not working...
gb spam
gbofspam at gmail.com
Tue May 3 10:38:53 UTC 2005
> whenever i try to execute a command in fedora core 3
> through crontab top -n 1 > /home/ashish/list. the output is not
> generated. i have tried this command through crontab for varios users
> but of no use. i have tried it in /etc/crontab also.plz help me
top doesn't like running from cron - it likes to know about your
terminal so that it move the cursor around, change text colour etc.
in a cron job, you don't have a terminal. you can see a similar
effect with:
$ top -n 1 < /dev/null
top: failed tty get
to get round this, use "-b" (batch mode) which does not have all the
'pretty' output, but doesn't need to know anything about your
terminal:
$ top -b -n 1 < /dev/null
top - 06:36:42 up 1 day, 13:39, 3 users, load average: 0.34, 0.36, 0.17
Tasks: 115 total, 1 running, 114 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.7% us, 0.7% sy, 0.0% ni, 98.5% id, 0.1% wa, 0.0% hi, 0.0% si
Mem: 2072580k total, 1901044k used, 171536k free, 432356k buffers
Swap: 2048248k total, 0k used, 2048248k free, 579044k cached
<snip>
This is, of course, in addition to getting your cron table set up
correctly, a la other poster.
More information about the fedora-list
mailing list