I'm calling at jobs on AIX servers using this method:
/usr/bin/at now +1 minute << EOF
chmod 700 /var/tmp/somescript.sh
cd /var/tmp
sh /var/tmp/somescript.sh > 2>&1
EOF
If ever some output is generated (because i.e. the script I'm calling doesn't exist), an email is sent to the default mail configured for cron jobs. I know this is default behavior and that is fine. However, if I want to change the MAILTO variable used, how can I do it using the method above ?
I tried adding [email protected] in the at script but that didn't work. The mail still went to the default address.
i.e.
/usr/bin/at now +1 minute << EOF
[email protected]
chmod 700 /var/tmp/somescript.sh
cd /var/tmp
sh /var/tmp/somescript.sh > 2>&1
EOF
The reason I'm using this method is because the jobs are created on a fly by another system, but this is irrelevant. I need to do it this way and can't edit the crontab.