如何编写一个将在午夜每天运行脚本的cron? [英] How to write a cron that will run a script every day at midnight?

查看:146
本文介绍了如何编写一个将在午夜每天运行脚本的cron?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案

我已经听说crontab是一个不错的选择,但是我如何写这行, >

这是一个很好的教程,介绍了什么是crontab,以及如何在Ubuntu上使用它。您的crontab行将如下所示:

  00 00 * * * ruby​​ path / to / your / script.rb 

00 00 表示午夜 - 0分钟0小时 - * 意味着每个月的每一天。)

 
语法:
mm hh dd mt wd命令

mm分钟0-59
hh小时0-23
dd月份日期1-31
mt month 1-12
wd星期几0-7(星期天= 0或7)
命令:要运行的内容
所有数字值都可以替换为*,表示所有


I have heard crontab is a good choice, but how do I write the line and where do I put it on the server?

Here's a good tutorial on what crontab is and how to use it on Ubuntu. Your crontab line will look something like this:

00 00 * * * ruby path/to/your/script.rb

(00 00 indicates midnight--0 minutes and 0 hours--and the *s mean every day of every month.)

Syntax: 
  mm hh dd mt wd  command

  mm minute 0-59
  hh hour 0-23
  dd day of month 1-31
  mt month 1-12
  wd day of week 0-7 (Sunday = 0 or 7)
  command: what you want to run
  all numeric values can be replaced by * which means all

这篇关于如何编写一个将在午夜每天运行脚本的cron?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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