Fix run on start up problem

This commit is contained in:
Teddysun 2014-05-27 16:53:44 +08:00
parent da9e1ec2d3
commit eec2952223

View File

@ -137,6 +137,7 @@ function install(){
if [ -f /usr/bin/ssserver ]; then if [ -f /usr/bin/ssserver ]; then
# Run shadowsocks in the background # Run shadowsocks in the background
nohup ssserver -c /etc/config.json > /dev/null 2>&1 & nohup ssserver -c /etc/config.json > /dev/null 2>&1 &
sleep 1
# Run success or not # Run success or not
ps -ef | grep -v grep | grep -v ps | grep -i '/usr/bin/python /usr/bin/ssserver' > /dev/null 2>&1 ps -ef | grep -v grep | grep -v ps | grep -i '/usr/bin/python /usr/bin/ssserver' > /dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
@ -147,7 +148,8 @@ function install(){
# Add run on system start up # Add run on system start up
cat /etc/rc.d/rc.local | grep 'ssserver' > /dev/null 2>&1 cat /etc/rc.d/rc.local | grep 'ssserver' > /dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "nohup ssserver -c /etc/config.json > /dev/null 2>&1 &" >> /etc/rc.d/rc.local cp /etc/rc.d/rc.local /etc/rc.d/rc.local.bak
echo "nohup /usr/bin/python /usr/bin/ssserver -c /etc/config.json > /dev/null 2>&1 &" >> /etc/rc.d/rc.local
fi fi
else else
echo "" echo ""
@ -188,6 +190,10 @@ function uninstall_shadowsocks(){
fi fi
# delete config file # delete config file
rm -f /etc/config.json rm -f /etc/config.json
if [ -f /etc/rc.d/rc.local.bak ];then
rm -f /etc/rc.d/rc.local
mv /etc/rc.d/rc.local.bak /etc/rc.d/rc.local
fi
pip uninstall -y shadowsocks pip uninstall -y shadowsocks
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Shadowsocks uninstall success!" echo "Shadowsocks uninstall success!"