Add/Modify Cron Jobs
Update Cron to mail to a particular user
crontab -e
Adding Path to Cron
Cron runs with a very limited shell. You may find that you need to set the path for certain things to work. You can add this to the beginning of the crontab.
crontab -e
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
MailTo
If you want to get cronjob emails, set MAILTO in the crontab:
crontab -e
MAILTO="xxx@yahoo.com"
If you don't want to receive any emails from cron, set the MAILTO=""
MAILTO=""
If you are using Ssmpt with cron, you will also need to replace the symlink for sendmail with a script.
rm /usr/sbin/sendmail
vi /usr/sbin/sendmail
#!/bin/sh ARGS=$@ sed -r -e 's/^From: root \(Cron Daemon\)\s*$/From: Cron Daemon <xxx@yahoo.com>/' | /usr/sbin/ssmtp $@
chmod +x /usr/sbin/sendmail
References
Reference | URL |
---|---|
sSMTP tips & tricks | https://www.axllent.org/docs/ssmtp/ |