shadowsocks / shadowsocks-libev

Bug-fix-only libev port of shadowsocks. Future development moved to shadowsocks-rust
https://github.com/shadowsocks/shadowsocks-rust
GNU General Public License v3.0
15.84k stars 5.7k forks source link

launch ss-server with snap will stop when ssh terminal close #2794

Open fan123199 opened 3 years ago

fan123199 commented 3 years ago

What version of shadowsocks-libev are you using?

install by snap

What operating system are you using?

ubuntu 20.10, and just created without doing anything else

What did you do?

root user

install by snap

snap install shadowsocks-libev

and then start by below

shadowsocks-libev.ss-server -c xxx/config.json -f 1234.pid

I can start successfully , but when I close ssh terminal, the ss-server process is killed.

What did you expect to see?

ss-server run background when terminal closed

What did you see instead?

when I close ssh terminal, the ss-server process is killed.

What is your config in detail (with all sensitive info masked)?

I think it is not related to config file.

HowieForrest commented 3 years ago

I solved this by adding a .service file to /etc/systemd/system/, so you can use systemctl to start ss-libev as a service, tho ss-rust is what im using.

[Unit]
Description=Shadowsocks-libev
After=network.target

[Service]
ExecStart=**/WHERE/SS-SERVER/IS/LOCATED** --config **/WHERE/CONF/IS/LOCATED**

[Install]
WantedBy=multi-user.target

Save it as shadowsocks-libev.service, move it to /etc/systemd/system/

start service: systemctl start shadowsocks-libev.service

start service when starting up: systemctl enable shadowsocks-libev.service

check its status: systemctl status shadowsocks-libev.service

Owl-dy commented 3 years ago

i know it's not a great solution... but i just use screen to run it screen shadowsocks-libev.ss-server -c ~/config.json