GoogleSearching for relevant answers is usually about putting scripts.
I created such a script and put it in
#!/bin/sh sslocal -s server-ip -p server-port -l 1080 -k password -t 600 -m aes-256-cfb
The permissions are set up:
$ chmod +x /etc/init.d/shadowsocks.sh
But when the boot is restarted, the 1080 port is not booted, and the script is not executed. What is the reason? What is the easiest way to execute this command when I have to turn on the machine?
If I put the above commands in
sslocal -s server-ip -p server-port -l 1080 -k password -t 600 -m aes-256-cfb
The system will remain stuck until it has been logged in. It has been torn for a long time.
Ctrl+Alt+F1The command line is logged in to the above command
/etc/profileThe following is removed to solve. Can a friend explain the reason?
Since the startup script is read from the /etc/rcN.d/ folder, in general, this folder is a soft connection to the files in the /etc/init.d/ folder. But even if you write like this, it’s also a problem.So, because it’s not a backstage process
Simple point, you can write directly to /etc/rc.local
If you want to put it in /etc/init.d, your script is not right. Even if it is right, you must use chkconfig to match it, and Baidu yourself.
My own solution, in order to better manage the process, I used to do supervisord management, set up autorestart and supervisior services to boot from boot (should be set automatically when the apt-get installation) to achieve this goal
With shadowsocks-libev, the script comes with SYSTEMd.
localA little change is done at the end.
Here is a sample for you.
[Unit] Description=Shadowsocks-libev Default Server Service Documentation=man:shadowsocks-libev(8) After=network.target [Service] Type=simple EnvironmentFile=/etc/default/shadowsocks-libev LimitNOFILE=32768 ExecStart=/usr/bin/ss-local -c $CONFFILE $DAEMON_ARGS [Install] WantedBy=default.target