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,050
  • 14
  • 49
  • 78

1 Answers1

4

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

gWaldo
  • 11,887
  • 8
  • 41
  • 68
  • It didn't help however I just completely removed the xargs command and it works fine. – HTF Aug 07 '12 at 12:03