如何解决Linux Cron 作业列线宽输出
我需要一点帮助:D
我有一个在控制台中运行良好的 script.sh,每行输出几乎有 140 个字符/列。
样本输出
Effective port range: 1024-65535,Effective number of port blocks: 63504,Effective number of ports: 4064256,Max number of port blocks used: 43438,Current number of port blocks in use: 20749,Port block allocation errors: 0
问题是当作为 Cron 作业执行时,输出显示/限制为 80 个字符/列,我不知道该怎么做,因为我已经尝试了一切......
COLUMNS=999
fold -w200
fmt -w200
我还在脚本中添加了 PATH,但似乎没有任何效果。
脚本将输出保存到这样的 txt 文件中(每小时):
00 * * * * /some/path/script.sh someIP > /another/path/output.txt
ip=$1
expect <<EOF
spawn ssh user@$ip
expect "*:*"
send "password\r"
expect "*>*"
send -- "show services nat pool|match \"Effective number\"|no-more\r"
expect "*>*"
send -- "show services nat pool detail|match \"Current number\"|no-more\r"
expect "*>*"
send -- "quit\r"
EOF
全局变量 COLUMNS 设置为 128,但始终拆分为最多 80 个字符
我还有 Linux CentOS 6,用 PHP 脚本而不是 bash 文件处理输出会更容易吗?谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com(将#修改为@)