2017-03-28 5 views
-1

私はcron式が初めてです。すべての1日後、午後5時に実行するHangfireの定期ジョブ用のcronを作成する方法を知っておく必要があります。午前は、Hangfireも標準CronExpressionを受け入れることを理解午後2:45毎日何度か実行するhangfireジョブのcron式の作成方法

は、私はこの周波数のためのcron表現を模索しようとしましたが、私はそれが15分間行われます方法を知っているIT-https://en.wikipedia.org/wiki/Cron ための1つを見つけませんでしたか? */15 * * * * 毎日実行する必要があります。

+0

「man crontab」について**具体的には何が不明で、あなたは簡単な検索で説明していませんでしたか? – Olaf

答えて

2

cronジョブのschedularで使用される一般的な構文は次のとおりです。cronジョブのschedularによって使用されるすべてのフィールドの

# Execute the <b>command</b> every minute of every day. 
* * * * * command 

説明:代わりに、最初の5つのフィールドの

# field # meaning  allowed values 
# ------- ------------ -------------- 
# 1  minute   0-59 
# 2  hour   0-23 
# 3  day of month 1-31 
# 4  month   1-12 (or names, see below) 
# 5  day of week 0-7 (0 or 7 is Sun, or use names) 

、8つの特別な文字列のいずれかすることができます

string   meaning 
------   ------- 
@reboot  Run once, at startup. 
@yearly  Run once a year, "0 0 1 1 *". 
@annually  (same as @yearly) 
@monthly  Run once a month, "0 0 1 * *". 
@weekly  Run once a week, "0 0 * * 0". 
@daily   Run once a day, "0 0 * * *". 
@midnight  (same as @daily) 
@hourly  Run once an hour, "0 * * * *". 

間隔をあけてジョブを繰り返すには/が使用されている:

*/15 * * * * command 

# This will execute the command after every 15 minutes. 

特定の時間でジョブを実行するためには、を使用することができますB:あなたの疑問をクリアし

* 2,20 * * * command 

# This will execute the job every minute but at the hours 2 AM and 8 PM. 

ホープ。

+0

ありがとうございます。 –

+0

Like 1日に2回ジョブを実行したい場合(6 AMと6 Pm) トウモロコシは* 6,18 * * *のようになります。 –

関連する問題