Cron在Ubuntu的工作 [英] Cron jobs in Ubuntu

查看:100
本文介绍了Cron在Ubuntu的工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在ubuntu中运行cron作业,以便启动python脚本?

How to run a cron job in ubuntu in such a way that it should initiate a python script?

请用一个小例子解释。

推荐答案

您可以设置一个简单的行从x到x时间:

You can set a simple line to run from x to x time:

strong>例如

e.g.,

0,10,20,30,40,50 * * * * ~/py/my_python_script.py

每10分钟运行

逐步使用VIM作为所选编辑


  1. 在您的终端,运行: sudo crontab -e

vim)

键入:i ,然后按输入插入新行

过去或写入cronjob行 0,10,20,30,40,50 * * *〜/ py / my_python_script.py 并按输入,然后 return 退出该行

Past or write the cronjob line 0,10,20,30,40,50 * * * * ~/py/my_python_script.py and hit enter and then return to exit that line

键入:w ,然后按输入,以写入文件

type :w and hit enter, to write the file

键入:q ,然后按 enter

type :q and hit enter to exit

星号说明 p>

Description for the asterisks:

minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday), command 



深入: / h1>

要详细了解其工作原理,请参阅:

In-deep:

To read a more detailed process on how it all works:

CronHowto

VIM命令作弊表

这篇关于Cron在Ubuntu的工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆