クローンを正常に起動できません

クローンを正常に起動できません

Bashスクリプトを実行する必要があるcronジョブがあります。私のローカルマシンでcronジョブが正常に動作しているので、bashスクリプトが機能していることを確認しました。

しかし、cronジョブは私がアクセスできるリモートシステムで実行されていないようです。テストでタッチコマンドを実行しましょう。私のクローンの仕事は次のとおりです。

# Edit this file to introduce tasks to be run by cron.
# 
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
# 
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
# 
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
# 
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
# 
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
# 
# For more information see the manual pages of crontab(5) and cron(8)
# 
# m h  dom mon dow   command
21 12 * * * /usr/bin/touch /home/aidan/test.txt

このクローン操作では、「/usr/bin/touch」にtest.txtファイルを生成する必要があります。しかし、まったく発射されないようです。

デバッグのために、次の2つのコマンドを使用して "/var/log/syslog"を調べました。

  1. sudo cat /var/log/syslog | sudo cat /var/log/syslog | grep -w 'cron' このコマンドは、次の出力を取得します。
Dec 13 20:21:01 onecup cron[1628]: (aidan) RELOAD (crontabs/aidan)
  1. sudo grep CRON /var/log/syslog.txt このコマンドは、次の出力を取得します。
Dec 13 17:17:01 onecup CRON[1060280]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Dec 13 18:17:01 onecup CRON[1120928]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Dec 13 19:17:01 onecup CRON[1180117]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Dec 13 20:17:01 onecup CRON[1238901]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)

このコマンドには cron ジョブはまったく表示されません。
私の期待は、CMDが現れなければならないということです。

簡単に言えば、cronjobがリロードされているようですが、いいえ実際に撮影します。誰でもどんなアイデアがありますか?

また、私がここで見た内容は次のとおりです。https://stackoverflow.com/questions/60842683/cron-not-running-tasks-ubuntu-18-04

問題は解決されませんでした。

ベストアンサー1

問題を発見しました。マシンはUTCゾーンで実行されていて、私はPSTゾーンで実行していました。そのため、cron ジョブが予想される現地時間では実行されません。

おすすめ記事