Help us understand the problem. What is going on with this article?

heroku schedulerで任意の曜日のみ実行する方法

はじめに

heroku schedulerの実行指定を曜日単位で実行するための方法です。

heroku scheduler

heroku schedulerの実行日時の指定は大きく3種類。

  • Every 10 minuts
  • Every hour at..
  • Every day at..

スクリーンショット 2019-09-07 15.34.55.png
・毎週○曜日だけ実行したい
・毎月○日だけ実行したい
みたいなことを考えたことありませんか?

指定方法

例: 火曜日だけあるバッチをコールしたい
[ $(date +%w) = 2 ] && rake ◯◯◯:◯◯◯

フォーマット 出力値
%a 日, 月, 火, 水, 木, 金, 土
%A 日曜日, 月曜日, 火曜日, 水曜日, 木曜日, 金曜日, 土曜日
%u 1 〜 7。1が月曜日、7が日曜日
%w 0 〜 6。0が日曜日、6が土曜日
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away