Archlinux systemd 開機執行rc.local

Archlinux 替換initscript 爲systemd方式後,許多服務啓動方式已經發生變化。原來的/etc/rc.local已經消失,並被建議使用tmpfiles.d方式替換。可是有些操做tmpfiles.d沒法替代。 linux

 須要手動寫一個rc-local.service 文件。 shell

vim /usr/lib/systemd/system/rc-local.service

內容以下:
vim

[Unit]
Description="/etc/rc.local Compatibility"


[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardInput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

 啓用腳本 spa

systemctl enable rc-local.service

建立啓動文件rc.local, code

vim /etc/rc.d/rc.local

ln -s /etc/rc.d/rc.local /etc

chmod +x /etc/rc.d/rc.local


輸入你的開機執行的操做,例如 ip

hdparm -B199 /dev/sda    #解決c1門,卡頓,對於機械硬盤有效,ssd就別了
相關文章
相關標籤/搜索