在 GNU/Linux 中,將啟動時執行的腳本寫入 /etc/rc.local!
大家好,我是無能。
令人意外的是,有很多文章提到寫入 .profile 等,但由於這是在登入後才執行的操作,對於運行伺服器的系統來說,反而可能不太常用。
由於事後追加並讓其常駐運行的腳本或啟動項往往會越來越多,常常會搞不清楚哪個是哪個,因此我會將它們寫入 rc.local。
sudo vi /etc/rc.local
~
#!/bin/sh
tlp start
# /etc/rc.local – rc.local for Artix Linux
# Enter your custom commands here.
~
紅色字體是這次新增的部分。
如果數量相當多,或許將它們整理到一個名為 startup.sh 的 shell 腳本中執行會比較好。
sudo chmod +x /etc/rc.local
這樣就可以了。
結束。