Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
share|improve this question
up vote 4 down vote accepted

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

share|improve this answer
    
It didn't help however I just completely removed the xargs command and it works fine. – HTF Aug 7 '12 at 12:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.