Ubuntu编写开机自启动脚本(转载)
生活随笔
收集整理的這篇文章主要介紹了
Ubuntu编写开机自启动脚本(转载)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
From:http://blog.csdn.net/marujunyy/article/details/8466255
1、首先編寫一個簡單的shell腳本test.sh
#! /bin/bash echo "Hello world!" filename=`date"+%Y%m%d"` echo $filename2、設(shè)置腳本開機自啟動
方法一:
編輯/etc/init.d/rc.local文件,在最后添加編寫的腳本即可。
比如:將/home/test.sh添加為開機自啟動
編輯/etc/init.d/rc.local,在末尾添加如下內(nèi)容:
sh /home/test.sh即可開進自動加載腳本
方法二:
1)將腳本復(fù)制到/etc/init.d目錄下
2)修改/etc/init.d/test.sh權(quán)限
chmod 755 /etc/init.d/test.sh update -rc.d test.sh default 95輸字95為腳本啟動的順序號。
?
卸載啟動腳本的方法:
cd /etc/init.d
update-rc.d -f test.sh remove
?
轉(zhuǎn)載于:https://www.cnblogs.com/xiaoerlang/p/3585510.html
總結(jié)
以上是生活随笔為你收集整理的Ubuntu编写开机自启动脚本(转载)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。