Artificial intelligent assistant

output of top gets truncated to 80 columns when run by cron I have got the following logging script: #!/bin/bash top -b -c -n 1 >> /var/log/toplog/top.log And the following record in my crontab: */1 * * * * /home/clime/scripts/toplog.sh The problem is that lines in top.log are being cut to 80 chars, e.g.: 1512 root 20 0 80756 1436 572 S 0.0 0.1 0:05.92 /usr/libexec/postfi This does not happen if I run the command directly from console. I have tried to use COLUMNS variable: */1 * * * * COLUMNS=999 /home/clime/scripts/toplog.sh But that leads to every line being long exactly 999 characters - unused space is padded with spaces, which is not what I want. How to fix this strange issue? My system is centos 6.3.

`top` always displays spaces until the last screen column. You just don't realize it when it's printing to the terminal because you can't visually distinguish a line with trailing spaces from a line without trailing space. You'll notice the spaces if you copy-paste with the mouse or in `screen`.

If you want to get rid of the spaces, just filter them away.


COLUMNS=9999 top -b -c -n 1 | sed 's/ *$//' >>/var/log/toplog/top.log


Whatever you're running `top` for, there are probably far better monitoring tools available.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 641abeb6bd8f0e38bae58ad97aecca64