Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to send cron output to an email address and am struggling... I'm running the following command:

13 15 * * 1-5 root /path/to/mysql-backup.sh 2>&1 | mail -s "Daily Database Backup Report" my.email@emailhost.com

That shows this error within /var/mail/root

/usr/bin/mail: line 1: syntax error near unexpected token `('
/usr/bin/mail: line 1: `Config file not found (-s)'

Is this trying to validate/execute the output of the cron?

Do you do this on your server? If so, how?

share|improve this question

migrated from stackoverflow.com Jan 6 '12 at 14:50

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 0 down vote accepted

In my experience, /usr/bin/mail is a binary executable, but on your system the shell seems to be loading and interpreting it. syntax error near unexpected token is a bash diagnostic.

This can happen if you have overwritten an executable. Is there any conceivable chance that you have overwritten /usr/bin/mail with the text "Config file not found (-s)", causing said text to be fed to the shell when you try to execute it?

share|improve this answer

Have you tried mailx if it works? or check if you can do the mail within the bash script itself.

share|improve this answer

Your Answer


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.