/etc/aliases & Sendmail

I've recently migrated a Solaris 10 server, to Redhat. I've migrated all my crons & scripts and now I'm attempting to set all the aliases, to send to the appropriate accounts. I have a particular user defined in /etc/aliases, however, when a particular script is ran in cron, I do not receive any emails. Here's an example of a script that runs, that does send an email appropriately, on the old box.

0 5 * * * su - user -c "/directory/subdirectory/custom/script cycle force" 2> /dev/null > /dev/null 

Any insight as to why I'm not receiving emails for this, is appreciated. Sendmail is working and I do receive root crons. To add, all of these crons run under the root crontab. Thanks!

Have you set your $PATH within the script?

Does the script work if you run it by hand?

Also, for simplicity you can substitute 2> /dev/null > /dev/null with &> /dev/null .

I'm wondering though, if the script runs as a different user, why don't you schedule it through the user's crontab instead of root?

Check Aliases as well

  • Did you Issue newaliases command to get the changes in effect. ?

# vi /etc/aliases
User1: Superman
#newaliases

If you email to User1 it should be received by Superman