私の/etc/crontab
ファイルには次のものがあります。
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
これが実際に何をしているのかはわかりますが、コマンドラインを理解していません。
「テスト」という男はまったく役に立ちません。
test - check file types and compare values
どんな助けでも大変感謝します。
ベストアンサー1
FreeBSDからman test
:[1]
-x file True if file exists and is executable. True indicates only
that the execute flag is on. If file is a directory, true
indicates that file can be searched.
そのため、cronjobsはそれがインストールanacron
されているかどうかをテストし、[2](つまり、予想される場所にanacronという名前の実行可能ファイルがあります)を実行します。そうでない場合- つまり、そのフォルダのスクリプトです/etc/cron.*
。
(1)Bashの組み込みオプションにはtest
同じ-x
オプションがあります
(2)Anacronは、常に実行されていないコンピュータ、つまり実行するタスクがある場合のために設計されたクローン代替プログラムです。週間、実行されます週間、コンピュータの稼働時間に備えてつまり、毎週金曜日ではなく、稼働時間24*7時間ごとに実行されるという意味です。 (編集する間違っていますコメントを見てください)