广告
返回顶部
首页 > 资讯 > 后端开发 > Python >Schedule tasks on L
  • 712
分享到

Schedule tasks on L

Scheduletasks 2023-01-31 01:01:21 712人浏览 薄情痞子

Python 官方文档:入门教程 => 点击学习

摘要

Mailing the crontab output By default cron saves the output in the user's mailbox (root in this case) on the local

Mailing the crontab output

By default cron saves the output in the user's mailbox (root in this case) on the local system. But you can also configure crontab to forward all output to a real email address by starting your crontab with the following line:
MAILTO="yourname@yourdomain.com"

Mailing the crontab output of just one cronjob

If you'd rather receive only one cronjob's output in your mail, make sure this package is installed:
aptitude install mailx
And change the cronjob like this:
*/10 * * * * /bin/execute/this/script.sh 2>&1 | mail -s "Cronjob ouput" yourname@yourdomain.com

Trashing the crontab output

Now that's easy:
*/10 * * * * /bin/execute/this/script.sh 2>&1 > /dev/null
Just pipe all the output to the null device, also known as the black hole. On Unix-like operating systems, /dev/null is a special file that discards all data written to it.

--结束END--

本文标题: Schedule tasks on L

本文链接: https://www.lsjlt.com/news/183331.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • Schedule tasks on L
    Mailing the crontab output By default cron saves the output in the user's mailbox (root in this case) on the local ...
    99+
    2023-01-31
    Schedule tasks
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作