2

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
HTF
  • 3,278

1 Answers1

4

Provide the full path to postsuper in your script. It's probably just not in cron's $PATH.

gWaldo
  • 12,027