xp-ss.sh 750 B

1234567891011121314151617181920
  1. #!/bin/bash
  2. data=( `cat /etc/shadowsocks-libev/akun.conf | grep '^###' | cut -d ' ' -f 2`);
  3. now=`date +"%Y-%m-%d"`
  4. for user in "${data[@]}"
  5. do
  6. exp=$(grep -w "^### $user" "/etc/shadowsocks-libev/akun.conf" | cut -d ' ' -f 3)
  7. d1=$(date -d "$exp" +%s)
  8. d2=$(date -d "$now" +%s)
  9. exp2=$(( (d1 - d2) / 86400 ))
  10. if [[ "$exp2" = "0" ]]; then
  11. sed -i "/^### $user $exp/,/^port_http/d" "/etc/shadowsocks-libev/akun.conf"
  12. systemctl disable shadowsocks-libev-server@$user-tls.service
  13. systemctl disable shadowsocks-libev-server@$user-http.service
  14. systemctl stop shadowsocks-libev-server@$user-tls.service
  15. systemctl stop shadowsocks-libev-server@$user-http.service
  16. rm -f "/etc/shadowsocks-libev/$user-tls.json"
  17. rm -f "/etc/shadowsocks-libev/$user-http.json"
  18. fi
  19. done