CoreOS:起動時にカスタムスクリプトを一度だけ実行する

CoreOS:起動時にカスタムスクリプトを一度だけ実行する

私は次のCoreOS v1688.5.3 [Rhyolite]サーバーを使用しており、サーバーの起動時に特定のPythonスクリプトを一度だけ実行する必要があるという特定の要件があります。これを達成するための最良の方法は何ですか?

ベストアンサー1

/etc/crontab最も簡単な方法は、次のタスクで作成することです。

@reboot /path/to/your/python/script.sh

より多くの情報を得ることができます。人5クローンタップ

CoreOSはそうではありません/etc/crontab


別の方法は生成することです。システムタイマー。 systemd-timerの例は、systemdに対する私の答えから得ることができます。systemd-shutdownd スケジュールの使用

systemd-timerの簡単な例は次のとおりです/etc/systemd/system/example.timer

[Unit]
Description=Run once at system boot

[Timer]
# You may chose one of this triggers
OnBootSec=0min # run after system boot
OnStartupSec=0min # run after systemd was started

[Install]
WantedBy=timers.target # target in wich timer will be installed

おすすめ記事