The script works fine when executed manually but I recived the folloing error while it's run as a cron job: 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