Debian系統(tǒng)要讓程序開(kāi)機(jī)自啟動(dòng),除了程序自帶的開(kāi)機(jī)自啟動(dòng)功能外,還能手動(dòng)設(shè)置,可通過(guò)對(duì)rc.local文件的編輯來(lái)實(shí)現(xiàn),下面小編就給大家詳細(xì)介紹下Debian設(shè)置程序開(kāi)機(jī)自啟動(dòng)的方法。

代碼如下
sudo vi /etc/rc.local
在exit 0之前添加軟件啟動(dòng)命令。如:
/usr/local/bin/sslocal -c /etc/shadowsocks.json
保存文件,重啟系統(tǒng)即可生效
有人如果是要把服務(wù)添加進(jìn)去我們可以參考下面方法
添加自啟動(dòng)服務(wù)
1. 新建腳本文件
在 /etc/init.d 下加入腳本文件
代碼如下
sudo vi /etc/init.d/aria2c
輸入內(nèi)容:
#!/bin/sh
### BEGIN INIT INFO
# Provides: Aria2
# Required-Start: $network $local_fs $remote_fs
# Required-Stop:: $network $local_fs $remote_fs
# Should-Start: $all
# Should-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Aria2 - Download Manager
# Description: Aria2 - Download Manager
### END INIT INFO
NAME=aria2c
USER=pi
ARIA2C=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
CONF=/home/$USER/.aria2/aria2.conf
ARGS=“--conf-path=${CONF}”
test -f $ARIA2C || exit 0
。 /lib/lsb/init-functions
case “$1” in
start) log_daemon_msg “Starting aria2c” “aria2c”
start-stop-daemon -S -q -b -m -p $PIDFILE -c $USER -a $ARIA2C -- $ARGS
log_end_msg $?
;;
stop) log_daemon_msg “Stopping aria2c” “aria2c”
start-stop-daemon -K -q -p $PIDFILE
log_end_msg $?
;;
restart|reload|force-reload)
log_daemon_msg “Restarting aria2c” “aria2c”
start-stop-daemon -K -R 5 -q -p $PIDFILE
start-stop-daemon -S -q -b -m -p $PIDFILE -c $USER -a $ARIA2C -- $ARGS
log_end_msg $?
;;
status)
status_of_proc -p $PIDFILE $ARIA2C aria2c && exit 0 || exit $?
;;
*) log_action_msg “Usage: /etc/init.d/aria2c {start|stop|restart|reload|force-reload|status}”
exit 2
;;
esac
exit 0
好啦,以上就是華軍小編帶給大家的全部?jī)?nèi)容了,是不是很簡(jiǎn)單呢?你學(xué)會(huì)了么?想了解更多的相關(guān)內(nèi)容,請(qǐng)隨時(shí)關(guān)注華軍資訊動(dòng)態(tài)吧,歡迎到華軍來(lái)下載哦!
eMule怎么設(shè)置啟用MiniMule功能-eMule設(shè)置啟用MiniMule功能的方法
eMule怎么設(shè)置啟動(dòng)時(shí)自動(dòng)更新服務(wù)器列表-eMule設(shè)置啟動(dòng)時(shí)自動(dòng)更新服務(wù)器列表的方法
eMule怎么啟用Windows7任務(wù)欄特效-eMule啟用Windows7任務(wù)欄特效的方法
您好,如有軟件收錄需求,請(qǐng)將軟件打包,并附上軟件名稱、軟件介紹、軟件相關(guān)截圖、軟件icon、軟著、營(yíng)業(yè)執(zhí)照(個(gè)人沒(méi)有營(yíng)業(yè)執(zhí)照請(qǐng)?zhí)峁?duì)應(yīng)的開(kāi)發(fā)者身份證正反面以及手持身份證本人照片),發(fā)送至郵箱
https://user.onlinedown.net/login掃碼添加企業(yè)微信
如有產(chǎn)品建議或問(wèn)題反饋,歡迎告訴我們,您的意見(jiàn)是我們進(jìn)步的動(dòng)力!
掃碼添加官方公眾號(hào)