I have a text file topcommand.txt
which has a command as below:
* * * * * /usr/bin/top -c | grep 'some process name' >> /home/abcd/topout.txt
When I invoke this using crontab topcommand.txt
, file topout.txt
gets created but it is an empty file.
Is there something wrong with my top
command?
top -c
part of your line withtop -bn1
and see if it helps you. With-c
option, you are toggling the last known state of operational mode and it might give you a different behavior every time. – MelBurslan Mar 02 '16 at 23:46'some process name'
part must not containe any%
of course, unless escaped by backslash. – Ralph Rönnquist Mar 03 '16 at 01:41That command writes a warning message to the file -TERM environment variable not set. When i do an echo for the variable i see the variable is set.********iibd1:~> echo $TERM xterm
– lionell Mar 03 '16 at 05:13