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

查看:27
本文介绍了如何编写一个每天午夜运行脚本的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小时 0-23dd 月 1-31 日吨月 1-12wd 周中的第 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天全站免登陆