私のバックアップスクリプトは手動で実行すると正常に動作しますが、crontabは何も実行しません。私はFedora 35ワークステーションを実行しています。
crontabエディタの仕組み:
$ crontab -e
cronデーモンが実行されていません。次のコマンドはそれぞれ出力を生成しません。
$ pgrep cron
$ pgrep crond
$ pidof cron
$ pidof crond
cronを起動しようとしています。
$ whereis cron
cron: /usr/share/man/man8/cron.8.gz
$ whereis crond
crond: /usr/sbin/crond /usr/share/man/man8/crond.8.gz
$ sudo service cron start
Redirecting to /bin/systemctl start cron.service
Failed to start cron.service: Unit cron.service not found.
$ sudo systemctl start cron
Failed to start cron.service: Unit cron.service not found.
cronの代わりにcronieを使ってみました。
$ sudo dnf install cronie
Package cronie-1.5.7-3.fc35.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
$ sudo systemctl enable cronie.service
Failed to enable unit: Unit file cronie.service does not exist.
$ sudo systemctl start cronie.service
Failed to start cronie.service: Unit cronie.service not found.
さらに、anacron("cronie.service")は、以前にインストールされている場合はFedoraシステムのアップグレード後も維持されますが、驚くべきことに、新しくインストールした場合、少なくともFedora Server 35にはインストールされません。
ベストアンサー1
このコマンドを使用する場合:
# systemctl start crond.service
これにより、システムは再起動後もその情報を保持します。したがって、これを行うことを覚えておく必要はありません!
また、ステータスを確認するには、以下を使用してください。
# systemctl status crond.service
最後に、#はもちろんルートアカウントを意味するので、適切にsudoを使用したり使用したりしないでください。