Update comments

Signed-off-by: Teddysun <i@teddysun.com>
This commit is contained in:
Teddysun 2018-06-03 21:57:58 +09:00
parent df91fc68a0
commit 13a10b6ba8
No known key found for this signature in database
GPG Key ID: 09BD4C080AD6C46D

View File

@ -18,25 +18,25 @@ shadowsocks_init[3]=/etc/init.d/shadowsocks-go
shadowsocks_init[4]=/etc/init.d/shadowsocks-libev shadowsocks_init[4]=/etc/init.d/shadowsocks-libev
i=0 i=0
for init in ${shadowsocks_init[@]}; do for init in "${shadowsocks_init[@]}"; do
pid="" pid=""
if [ -f ${init} ]; then if [ -f ${init} ]; then
ss_status=`${init} status` ss_status=$(${init} status)
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
pid=`echo $ss_status | sed 's/[^0-9]*//g'` pid=$(echo "$ss_status" | sed -e 's/[^0-9]*//g')
fi fi
if [ -z ${pid} ]; then if [ -z "${pid}" ]; then
echo "`date +"%Y-%m-%d %H:%M:%S"` ${name[$i]} is not running" >> ${log} echo "$(date +'%Y-%m-%d %H:%M:%S') ${name[$i]} is not running" >> ${log}
echo "`date +"%Y-%m-%d %H:%M:%S"` Starting ${name[$i]}" >> ${log} echo "$(date +'%Y-%m-%d %H:%M:%S') Starting ${name[$i]}" >> ${log}
${init} start &>/dev/null ${init} start &>/dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "`date +"%Y-%m-%d %H:%M:%S"` ${name[$i]} start success" >> ${log} echo "$(date +'%Y-%m-%d %H:%M:%S') ${name[$i]} start success" >> ${log}
else else
echo "`date +"%Y-%m-%d %H:%M:%S"` ${name[$i]} start failed" >> ${log} echo "$(date +'%Y-%m-%d %H:%M:%S') ${name[$i]} start failed" >> ${log}
fi fi
else else
echo "`date +"%Y-%m-%d %H:%M:%S"` ${name[$i]} is running with pid $pid" >> ${log} echo "$(date +'%Y-%m-%d %H:%M:%S') ${name[$i]} is running with pid $pid" >> ${log}
fi fi
fi fi