In order for the Debian system to allow the program to start automatically at boot, in addition to the self-start function that comes with the program, it can also be set manually. This can be achieved by editing the rc.local file. The following editor will give you a detailed introduction to the Debian setup program to start up. Self-starting method.
The code is as follows
sudo vi /etc/rc.local
Add the software startup command before exit 0. like:
/usr/local/bin/sslocal -c /etc/shadowsocks.json
Save the file and restart the system to take effect
If someone wants to add services, we can refer to the following method
Add self-starting service
1. Create a new script file
Add script files under /etc/init.d
The code is as follows
sudo vi /etc/init.d/aria2c
Input content:
#! /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
Okay, the above is all the content brought to you by the editor of Huajun. Isn’t it very simple? Have you learned it? If you want to know more related content, please pay attention to Huajun information updates at any time. Welcome to Huajun to download!