开发者

Sendmail or SSMTP for CronJobs

开发者 https://www.devze.com 2023-04-05 04:21 出处:网络
I am using a Amazon ec2 insta开发者_JS百科nce(cron server with Ubuntu OS) to run all nightly cronjobs. There are some 8 sh files which run @ night. I get email alerts using sendmail for all the 8 sh f

I am using a Amazon ec2 insta开发者_JS百科nce(cron server with Ubuntu OS) to run all nightly cronjobs. There are some 8 sh files which run @ night. I get email alerts using sendmail for all the 8 sh files status.

Now i need to get a email alert for a particualr sh file, with its execution time duration. My concerns are :

-> can i do that with sendmail. if so, were i need to mention the to address, is it in crontab -e, or in that particular sh file.

-> can i do that with sendmail, or should i go for ssmtp?

-- Thanks, Anand S


Cron can't send you the execution time. You need a small wrapper which calls your app. You can use the "time" command:

@daily time orig-crontab-line

Example output

user@host> time ls
...

real    0m0.004s
user    0m0.001s
sys 0m0.003s

You can alter the mail recipient with MAILTO. See man 5 crontab

0

精彩评论

暂无评论...
验证码 换一张
取 消