LoginSignup
10
13

More than 5 years have passed since last update.

cronでバッチを設定する

Posted at

cronでバッチ処理

1. cronが起動しているか確認する

/etc/rc.d/init.d/crond status

2. cronに既にバッチ処理が設定されているか確認する

crontab -l

3. cronの設定ファイルを確認

 less /etc/crontab

4. バッチを設定する

 crontab -e
 0 0 * * * /bin/bash /home/xxx/cron_all.sh > /dev/null 2>&1
⇒分 時 日 月 曜日 コマンド

5. 念のためwindowsの改行があるか確認する。

 cat -v /home/xxx/cron_all.sh
^Mがあったら、NG(windowsの改行)
改行を除去する
 sed -i 's/\r//' /home/xxx/cron_all.sh

6. cronにバッチが設定されている事を確認。

crontab -l

10
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
13