Last active
April 18, 2018 14:45
-
-
Save wongsyrone/6cd295e1ed471173cbfe to your computer and use it in GitHub Desktop.
systemd ss-libev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/lib/systemd/system/shadowsocks-server@.service | |
[Unit] | |
Description=Shadowsocks libev Server Service | |
After=network.target | |
[Service] | |
Type=simple | |
User=root | |
ExecStart=/usr/bin/ss-server -u -v -A --fast-open -c /etc/shadowsocks/%i.json --acl /etc/shadowsocks/local.acl | |
[Install] | |
WantedBy=multi-user.target | |
----------------------------------------------------- | |
CentOS 7开始使用Systemd替代原有的init.d作为启动管理工具,原本以为很复杂,后来发现其实比init.d还要简单。 | |
安装完shadowsocks-libenv之后: | |
vim /etc/systemd/system/ss-redir.service | |
写入以下内容: | |
[Unit] | |
Description=Shadowsocks Redir Client | |
After=network.target | |
[Service] | |
Type=forking | |
PIDFile=/run/shadowsocks/redir.pid | |
PermissionsStartOnly=true | |
ExecStartPre=/bin/mkdir -p /run/shadowsocks | |
ExecStartPre=/bin/chown nobody:nobody /run/shadowsocks | |
ExecStart=/usr/local/bin/ss-redir -f /var/run/shadowsocks/redir.pid -c /usr/local/etc/ss-redir.json | |
Restart=on-abort | |
User=nobody | |
Group=nobody | |
UMask=0027 | |
[Install] | |
WantedBy=multi-user.target | |
然后运行 | |
systemctl enable ss-redir.service | |
启用此服务的自动运行 | |
开启服务:systemctl start ss-redir | |
查看状态 systemctl status ss-redir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment