2017年4月19日星期三

systemd管理shadowsocks-libev多端口自启动

以下在Debian8和CentOS7测试成功。仅路径有所不同。
安装参考shadowsocks-libev在github的说明。Debian用jessie-backports安装,CentOS用Fedora-Copr安装。


以下说明为Debian8上的操作。


cp /lib/systemd/system/shadowsocks-libev.service /lib/systemd/system/shadowsocks-libev1.service
nano /lib/systemd/system/shadowsocks-libev1.service

#  This file is part of shadowsocks-libev.
#
#  Shadowsocks-libev is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 3 of the License, or
#  (at your option) any later version.
#
#  This file is default for Debian packaging. See also
#  /etc/default/shadowsocks-libev for environment variables.

[Unit]
Description=Shadowsocks-libev 1 Server Service
Documentation=man:shadowsocks-libev(8)
After=network.target

[Service]
Type=simple
EnvironmentFile=/etc/default/shadowsocks-libev1
User=nobody
Group=nogroup
LimitNOFILE=32768
ExecStart=/usr/bin/ss-server -c $CONFFILE $DAEMON_ARGS

[Install]
WantedBy=multi-user.target



cp /etc/default/shadowsocks-libev /etc/default/shadowsocks-libev1
nano /etc/default/shadowsocks-libev1

# Defaults for shadowsocks initscript
# sourced by /etc/init.d/shadowsocks-libev
# installed at /etc/default/shadowsocks-libev by the maintainer scripts

#
# This is a POSIX shell fragment
#
# Note: `START', `GROUP' and `MAXFD' options are not recognized by systemd.
# Please change those settings in the corresponding systemd unit file.

# Enable during startup?
START=yes

# Configuration file
CONFFILE="/etc/shadowsocks-libev/config1.json"

# Extra command line arguments
DAEMON_ARGS="-u -v"

# User and group to run the server as
USER=nobody
GROUP=nogroup

# Number of maximum file descriptors
MAXFD=32768



cp /etc/shadowsocks-libev/config.json /etc/shadowsocks-libev/config1.json
nano /etc/default/shadowsocks-libev1

修改config1.json文件。
systemctl enable shadowsocks-libev1
systemctl start shadowsocks-libev1
systemctl status shadowsocks-libev1

没有评论:

发表评论

移动光猫改桥接模式

使用以下管理用户名和密码登录移动光猫: 用户名:CMCCAdmin 密码:aDm8H%MdA 登陆后,查看“网络-宽带设置”,选择名称中含有“INTERNET”的连接名称,截图记录原有INTERNET设置: 截图记录后,删除此配置。 参考原有配置,新建一个INTERNET连接,并...