Mail linux status

lufy
December 09, 2017

When we are doing some tests on linux that take very long time, and we have to monitor its status at every moment, in this case, we can set the mail client on linux, to inform test status through email. Next is how to set.


1. Edit /etc/mail.rc


# add the followed lines


set from=fei.lu@i-soft.com.cn smtp=mail.lufy90.com
set smtp-auth-user=lufy@lufy90.com smtp-auth-password=passwd smtp-auth=login


Then you can test your mail set with command:


]# ps -ef | mail -s test test@lufy90.com


The email titled with test from lufy@lufy90.com should be received.


2. edit /etc/crontab


/etc/crontab is used for setting scheduled jobs on linux. Daemon cron would execute jobs(commands) set in /etc/crontab. Here we can join the mail commands to schedule, such as push the output of test-info every hour:


]# vim /etc/crontab


0 root test-info | mail -s “Test status” test@lufy90.com


 


About crontab:


/5 * # every 5min


0 # every hour


0 0 * # every day


0 0 0 # every week


0 0 1 # every month


0 0 1 1 * # every year

Comments (0)

Leave a Comment
Maximum 1000 characters

No comments yet. Be the first to comment!