次のCoreOSv1688.5.3 [Rhyolite]サーバーを使用していますが、サーバーの起動時に特定のpythonスクリプトを1回だけ実行する必要があるという特定の要件があります。これを達成するための最良の方法は何でしょうか?
これを達成するための最も簡単な方法は、 /etc/crontab
次のタスクで作成する ことです。
@reboot /path/to/your/python/script.sh
man 5crontab から取得できる詳細情報 。
CoreOSにはありません/etc/crontab
。
もう1つの方法は、systemd-timerを作成することです。systemdに関する私の回答から得られるsystemd-timerの例: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
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加