当手动执行脚本时,脚本工作正常,但是当它作为cron作业运行时,我收到了以下错误: xargs: postsuper: No such file or directory
#!/bin/bash mailgueue=$(mailq | awk '/MAILER-DAEMON/ { print $1 }' | wc -l) if [ $mailgueue -ge 1 ] then /usr/bin/mailq | awk '/MAILER-DAEMON/ { print $1 }' | xargs -n 1 postsuper -d fi
在脚本中提供postsuper的完整path。 这可能只是不在cron的$ PATH。