manjaro 設置開機啟動腳本


以下命令以root用戶執行
1.創建一個啟動service腳本

vim /etc/systemd/system/rc-local.service
1
[Unit]
Description="/etc/rc.local Compatibility" 

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

[Install]
WantedBy=multi-user.target

2.創建 /etc/rc.local 文件
vim /etc/rc.local

#!/bin/sh
# /etc/rc.local
if test -d /etc/rc.local.d; then
    for rcscript in /etc/rc.local.d/*.sh; do
        test -r "${rcscript}" && sh ${rcscript}
    done
    unset rcscript
fi

3.添加執行權限

chmod a+x /etc/rc.local

4.添加/etc/rc.local.d文件夾

mkdir /etc/rc.local.d

5.設置開機自啟

systemctl enable rc-local.service

結尾:
sh腳本放在/etc/rc.local.d/里面就可以了
from https://blog.csdn.net/u014025444/article/details/90142558


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM