问题:我可以“尾随”邮件日志以实时查看 postfix 邮件日志,但是...是否有人编写了一种“合理格式化”的方法来做到这一点?
意思是:这是乱码......尽管我当然可以“挑出”这些东西......但我知道它可以被格式化更好。有人这样做过吗?谢谢。
这是我现在运行的小脚本......
#!/bin/bash
less +F /var/log/maillog
procstillrunning=$(ps -ef | grep less | grep -v "grep" | wc -l)
if (( "$procstillrunning" > 0 )); then
printf "\n\n\n\n"
echo "**************NOTE: LESS STILL RUNNING $procstillrunning TIMES. GO KILL IT."
printf "\n\n\n\n"
echo "Procs still running...."
ps -ef | grep less | grep -v "grep"
fi