超楽にRubyで雑に書いたスクリプトをsystemdで管理したい! - 宇宙行きたい で systemd がユーザ権限で使えることを知る。 開発環境用では nohup と cron の @reboot を使っていました。こちらもお手軽なので紹介。 @reboot とは crontab(5) に @reboot があれば使えます。その名の通りリブート時に一回だけ実行。Ubuntu なら利用可能。 $ man 5 crontab (省略) Instead of the first five fields, one of eight special strings may appear: string meaning ------ ------- @reboot Run once, at startup. @yearly Run once a year, "0 0 1 1 *". @annual
![サーバ再起動しても cron で Web アプリを雑に立ち上げ](https://cdn-ak-scissors.b.st-hatena.com/image/square/30ce5d1e1877929a92bac08035d3c33a1dcb98f0/height=288;version=1;width=512/https%3A%2F%2Fres.cloudinary.com%2Fzenn%2Fimage%2Fupload%2Fs--8r7Qe_EJ--%2Fc_fit%252Cg_north_west%252Cl_text%3Anotosansjp-medium.otf_55%3A%2525E3%252582%2525B5%2525E3%252583%2525BC%2525E3%252583%252590%2525E5%252586%25258D%2525E8%2525B5%2525B7%2525E5%25258B%252595%2525E3%252581%252597%2525E3%252581%2525A6%2525E3%252582%252582%252520cron%252520%2525E3%252581%2525A7%252520Web%252520%2525E3%252582%2525A2%2525E3%252583%252597%2525E3%252583%2525AA%2525E3%252582%252592%2525E9%25259B%252591%2525E3%252581%2525AB%2525E7%2525AB%25258B%2525E3%252581%2525A1%2525E4%2525B8%25258A%2525E3%252581%252592%252Cw_1010%252Cx_90%252Cy_100%2Fg_south_west%252Cl_text%3Anotosansjp-medium.otf_37%3Aoooooooo%252Cx_203%252Cy_121%2Fg_south_west%252Ch_90%252Cl_fetch%3AaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL3plbm4tdXNlci11cGxvYWQvYXZhdGFyL2RkOTQ3OGQzN2YuanBlZw%3D%3D%252Cr_max%252Cw_90%252Cx_87%252Cy_95%2Fv1627283836%2Fdefault%2Fog-base-w1200-v2.png)