I have CentOs 6.5 running on a VPS Host. I installed crontab and email using the below commands
yum install vixie-cron
service start crond
chkconfig crond --levels 235 on
yum install sendmail
service start sendmail
chkconfig sendmail --levels 235 on
Now, since I wanted my VPS to send me email, every 5 minutes (for test) about my server status, I found a script (5th example) that does that, or you can see it below:
MAX=95
EMAIL=USER@domain.com
PART=sda1
USE=`df -h |grep $PART | awk '{ print $5 }' | cut -d'%' -f1`
if [ $USE -gt $MAX ]; then
echo "Percent used: $USE" | mail -s "Running out of disk space" $EMAIL
fi
I downloaded the script using curl from the given URL and modified the EMAIL to reflect my email account.
Now, the last thing I did was, put the above shell script in /home/user/status.sh
and went in to tell cron tab to run it every five minutes.
$ crontab -e
*/5 * * * * /home/user/status.sh
I assumed this is enough to get the email, but I am not getting any. I have no problems with my email account. What could be the problem?
Additional Info:
I have root access. Just in case you thought I didn't.
And here is my cron log
[root@user log]# tail /var/log/cron Aug 17 15:15:31 site-name run-parts(/etc/cron.daily)[526]: finished makewhatis.cron Aug 17 15:15:31 site-name anacron[29624]: Job `cron.daily' terminated Aug 17 15:20:01 site-name CROND[622]: (root) CMD (/home/user/status.sh) Aug 17 15:25:01 site-name CROND[744]: (root) CMD (/home/user/status.sh)
- And My maillog