Add uninstall confirm dialog
This commit is contained in:
parent
5afb9cc4ad
commit
3eab56d528
|
|
@ -173,25 +173,32 @@ function install(){
|
||||||
|
|
||||||
# Uninstall Shadowsocks
|
# Uninstall Shadowsocks
|
||||||
function uninstall_shadowsocks(){
|
function uninstall_shadowsocks(){
|
||||||
NODE_PID=`ps -ef | grep -v grep | grep -v ps | grep -i '/usr/bin/python /usr/bin/ssserver' | awk '{print $2}'`
|
printf "Are you sure uninstall Shadowsocks? (y/n) : "
|
||||||
if [ ! -z $NODE_PID ]; then
|
read answer
|
||||||
for pid in $NODE_PID
|
printf "\n"
|
||||||
do
|
if [ "$answer" = "y" ]; then
|
||||||
kill -9 $pid
|
NODE_PID=`ps -ef | grep -v grep | grep -v ps | grep -i '/usr/bin/python /usr/bin/ssserver' | awk '{print $2}'`
|
||||||
if [ $? -eq 0 ]; then
|
if [ ! -z $NODE_PID ]; then
|
||||||
echo "Shadowsocks process[$pid] has been killed"
|
for pid in $NODE_PID
|
||||||
fi
|
do
|
||||||
done
|
kill -9 $pid
|
||||||
fi
|
if [ $? -eq 0 ]; then
|
||||||
# delete config file
|
echo "Shadowsocks process[$pid] has been killed"
|
||||||
rm -f /etc/shadowsocks.json
|
fi
|
||||||
rm -f /var/run/shadowsocks.pid
|
done
|
||||||
rm -f /etc/init.d/shadowsocks
|
fi
|
||||||
pip uninstall -y shadowsocks
|
# delete config file
|
||||||
if [ $? -eq 0 ]; then
|
rm -f /etc/shadowsocks.json
|
||||||
echo "Shadowsocks uninstall success!"
|
rm -f /var/run/shadowsocks.pid
|
||||||
|
rm -f /etc/init.d/shadowsocks
|
||||||
|
pip uninstall -y shadowsocks
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Shadowsocks uninstall success!"
|
||||||
|
else
|
||||||
|
echo "Shadowsocks uninstall failed!"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Shadowsocks uninstall failed!"
|
echo "uninstall cancelled, Nothing to do"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user