使用ssshell管理SS-libev后端

转自glzjin’s github

 

#!/bin/bash

dbaddress=你的数据库地址
dbname=你的数据库名称
dbusername=你的数据库用户名
dbpassword=你的数据库密码
ip=你的服务器 ifconfig-a对外网卡地址,nat过来的请填就局域网IP
nodeid=节点ID
version=你的前端 version,1= ss-panel v2,2= ss-panel v3 官方版,3= ss-panel v3 魔改版
nic=你的网卡名称 比如 eth0 ,ifconfig -a查看,openvz 的 vps 一般为 venet0  

wget https://copr.fedorainfracloud.org/coprs/librehat/shadowsocks/repo/epel-6/librehat-shadowsocks-epel-6.repo -O /etc/yum.repos.d/librehat-shadowsocks-epel-6.repo
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm --quiet    
yum install shadowsocks-libev -y
yum install libpcap-devel -y
wget https://github.com/glzjin/ssshell-jar/raw/master/libjnetpcap.so -O /usr/lib64/libjnetpcap.so
wget https://github.com/glzjin/ssshell-jar/raw/master/libjnetpcap-pcap100.so -O /usr/lib64/libjnetpcap-pcap100.so
chkconfig shadowsocks-libev off
yum install java-1.8.0-openjdk -y
yum install supervisor python-pip -y
yum install ntp -y
pip install supervisor==3.1
chkconfig supervisord on
wget https://github.com/glzjin/ssshell-jar/raw/master/supervisord.conf -O /etc/supervisord.conf
wget https://github.com/glzjin/ssshell-jar/raw/master/supervisord -O /etc/init.d/supervisord
mkdir /root/ssshell
wget https://github.com/glzjin/ssshell-jar/raw/master/ssshell.jar -O /root/ssshell/ssshell.jar 
wget https://github.com/glzjin/ssshell-jar/raw/master/ssshell.conf -O /root/ssshell/ssshell.conf
sed -i  "s/addresshere/${dbaddress}/" /root/ssshell/ssshell.conf 
sed -i "s/addressnamehere/${dbname}/" /root/ssshell/ssshell.conf 
sed -i "s/addressusernamehere/${dbusername}/" /root/ssshell/ssshell.conf 
sed -i "s/addressuserpassword/${dbpassword}/" /root/ssshell/ssshell.conf 
sed -i "s/iphere/${ip}/" /root/ssshell/ssshell.conf 
sed -i "s/nodeidhere/${nodeid}/" /root/ssshell/ssshell.conf 
sed -i "s/versionhere/${version}/" /root/ssshell/ssshell.conf 
sed -i "s/nichere/${nic}/" /root/ssshell/ssshell.conf 
pip install speedtest-cli



chmod 600 /root/ssshell/ssshell.conf
service supervisord start


wget –no-check-certificate https://pypi.python.org/packages/source/s/supervisor/supervisor-3.0.tar.gz

tar -zxvf supervisor-3.0.tar.gz

cd supervisor-3.0

python setup.py install
创建配置文件:
echo_supervisord_conf > /etc/supervisord.conf
修改配置文件:
在supervisord.conf最后增加:



[program:shadowsocks]
command = java -jar ssshell.jar
directory = /root/ssshell
user=root
autostart=true
autorestart=true
stderr_logfile = /var/log/shadowsocks.log
stdout_logfile = /var/log/shadowsocks.log
startsecs=3

使用指定配置文件启动:/usr/bin/supervisord -c /etc/supervisord.conf
-c 表示配置文件的路径,读取这里个配置文件,之前也是可以根据自己的情况放在不同的文件夹下
修改配置文件之后:supervisorctl reload 重载 服务重新启动
debug查看连接日志:supervisorctl tail -f shadowsocks stderr #Ctrl+C 取消查看
设置supervisord开机启动
编辑文件:vi /etc/rc.local
在末尾另起一行添加supervisord,保存退出(和上文类似)。
另centos7还需要为rc.local添加执行权限
chmod +x /etc/rc.local
至此运用supervisord控制shadowsocks开机自启和后台运行设置完成
常用命令
控制命令基本都通过supervisorctl执行,输入help可以看到命令列表。这是一些常用命令:
获得所有程序状态 supervisorctl status
关闭目标程序 supervisorctl stop shadowsocks
启动目标程序 supervisorctl start shadowsocks
关闭所有程序 supervisorctl shutdown
分享到:

28 条评论

昵称
  1. It’s going to be ending of mine day, except before finish
    I am reading this wonderful post to improve my experience.

  2. Elldrex

    Can You Take Perocet With Amoxicillin Kamagra Pharma Precio Viagra En Farmacias Espana [url=http://leviplus.com]compare viagra to cialis and levitra[/url] Viagra Tra I Giovani Baclofene Angers Best Buy On Cialus

  3. win2888 casino

    Simply wish to say your article is as surprising.
    The clarity in your post is simply great and i could assume you are an expert on this subject.
    Well with your permission allow me to grab your RSS feed to keep updated with
    forthcoming post. Thanks a million and please carry on the rewarding work.

  4. technonews

    Very nice post. I absolutely appreciate this website.

    Continue the good work!

  5. win2888 đăng ký 2018

    Excellent web site you have here.. It’s hard to find
    quality writing like yours these days. I truly appreciate individuals like
    you! Take care!!

  6. win2888 xsmb

    Hi there, You have done a great job. I will certainly digg it and personally recommend to my friends.
    I am confident they will be benefited from this web site.

  7. Today, I went to the beach with my kids. I found a sea shell and gave it to my 4 year old daughter and
    said “You can hear the ocean if you put this to your ear.” She put the shell to
    her ear and screamed. There was a hermit crab inside and it
    pinched her ear. She never wants to go back!

    LoL I know this is totally off topic but I had to tell someone!

  8. win2888 bong da

    It’s in fact very complex in this busy life to listen news on Television, therefore I only use internet for that
    purpose, and take the most recent information.

  9. tao tai khoan win2888

    Good site you’ve got here.. It’s difficult to find high quality writing like yours nowadays.

    I really appreciate individuals like you! Take care!!

  10. A person essentially help to make severely posts I might state.
    That is the very first time I frequented your website page and up to now?
    I amazed with the analysis you made to create this actual post incredible.

    Great activity!

  11. win2888 lô đề online

    My spouse and I stumbled over here coming from a different
    web page and thought I might as well check things out.
    I like what I see so i am just following you. Look
    forward to looking into your web page repeatedly.

  12. win2888 soi cau mien trung

    Hello, after reading this remarkable piece of writing i am too cheerful to share
    my know-how here with friends.

  13. cách đăng ký win2888

    Thanks for sharing your thoughts. I really appreciate your efforts and I am waiting for your next write ups thank
    you once again.

  14. lay lai tai khoan win2888

    That is very fascinating, You are an overly skilled blogger.
    I’ve joined your rss feed and look ahead to in search of extra of your excellent post.
    Also, I’ve shared your site in my social networks

  15. win2888 miền bắc

    Your way of describing all in this paragraph is genuinely good,
    every one can without difficulty be aware of it, Thanks a lot.

  16. Hi there all, here every one is sharing these experience, thus it’s nice to read this website, and I used to pay a quick visit this
    web site daily.

  17. soi cầu win2888

    great points altogether, you simply gained a new reader.
    What would you suggest about your submit that you just made a few days ago?
    Any positive?

  18. du doan win2888

    When some one searches for his vital thing, so he/she wishes to be
    available that in detail, thus that thing is maintained over here.

  19. Unquestionably believe that that you stated.
    Your favorite reason seemed to be at the web the simplest factor to take note of.
    I say to you, I definitely get irked even as other folks think about issues that they plainly don’t realize about.
    You controlled to hit the nail upon the highest as smartly as outlined out the entire thing without having side-effects , other folks could take a signal.
    Will likely be back to get more. Thanks

  20. long hổ win2888

    My family always say that I am wasting my time here at net, but I know
    I am getting experience all the time by reading such pleasant articles or reviews.

  21. http://orbitknowledge.com

    Incredible points. Solid arguments. Keep up the good
    work.

  22. Hey very interesting blog!

  23. computer

    Howdy, I think your web site may be having browser compatibility problems.

    When I look at your web site in Safari, it looks fine however, if opening in I.E., it’s got
    some overlapping issues. I merely wanted to give you a
    quick heads up! Other than that, excellent website!

  24. www.snapscores.com

    Good day! This is my first comment here so I just wanted to give a
    quick shout out and tell you I genuinely enjoy reading through your posts.
    Can you suggest any other blogs/websites/forums that cover the same topics?
    Many thanks!

  25. internetnews

    We’re a group of volunteers and opening a new scheme in our
    community. Your site provided us with valuable information to work on. You have done a formidable job and our whole community will be grateful to you.

  26. I was able to find good info from your articles.

  27. Hello it’s me, I am also visiting this site daily, this web site is really nice and the users are genuinely sharing nice thoughts.

  28. Vina

    Una pena pecuniaria di notevole entità penso che sia una buona soluzione; almeno così si può sperare in una certezza della pena; anche perchè, oltre a discutere sulie#8217;&fficacla deterrente della reclusione, bisogna vedere se effettivamente questa verrà applicata.