xp.sh 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #!/bin/bash
  2. data=( `cat /var/lib/premium-script/data-user-l2tp | grep '^###' | cut -d ' ' -f 2`);
  3. now=`date +"%Y-%m-%d"`
  4. for user in "${data[@]}"
  5. do
  6. exp=$(grep -w "^### $user" "/var/lib/premium-script/data-user-l2tp" | 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/d" "/var/lib/premium-script/data-user-l2tp"
  12. sed -i '/^"'"$user"'" l2tpd/d' /etc/ppp/chap-secrets
  13. sed -i '/^'"$user"':\$1\$/d' /etc/ipsec.d/passwd
  14. chmod 600 /etc/ppp/chap-secrets* /etc/ipsec.d/passwd*
  15. fi
  16. done
  17. data=( `cat /var/lib/premium-script/data-user-pptp | grep '^###' | cut -d ' ' -f 2`);
  18. now=`date +"%Y-%m-%d"`
  19. for user in "${data[@]}"
  20. do
  21. exp=$(grep -w "^### $user" "/var/lib/premium-script/data-user-pptp" | cut -d ' ' -f 3)
  22. d1=$(date -d "$exp" +%s)
  23. d2=$(date -d "$now" +%s)
  24. exp2=$(( (d1 - d2) / 86400 ))
  25. if [[ "$exp2" = "0" ]]; then
  26. sed -i "/^### $user $exp/d" "/var/lib/premium-script/data-user-pptp"
  27. sed -i '/^"'"$user"'" pptpd/d' /etc/ppp/chap-secrets
  28. chmod 600 /etc/ppp/chap-secrets*
  29. fi
  30. done
  31. data=( `cat /etc/shadowsocks-libev/akun.conf | grep '^###' | cut -d ' ' -f 2`);
  32. now=`date +"%Y-%m-%d"`
  33. for user in "${data[@]}"
  34. do
  35. exp=$(grep -w "^### $user" "/etc/shadowsocks-libev/akun.conf" | cut -d ' ' -f 3)
  36. d1=$(date -d "$exp" +%s)
  37. d2=$(date -d "$now" +%s)
  38. exp2=$(( (d1 - d2) / 86400 ))
  39. if [[ "$exp2" = "0" ]]; then
  40. sed -i "/^### $user $exp/,/^port_http/d" "/etc/shadowsocks-libev/akun.conf"
  41. systemctl disable shadowsocks-libev-server@$user-tls.service
  42. systemctl disable shadowsocks-libev-server@$user-http.service
  43. systemctl stop shadowsocks-libev-server@$user-tls.service
  44. systemctl stop shadowsocks-libev-server@$user-http.service
  45. rm -f "/etc/shadowsocks-libev/$user-tls.json"
  46. rm -f "/etc/shadowsocks-libev/$user-http.json"
  47. fi
  48. done
  49. data=( `cat /usr/local/shadowsocksr/akun.conf | grep '^###' | cut -d ' ' -f 2`);
  50. now=`date +"%Y-%m-%d"`
  51. for user in "${data[@]}"
  52. do
  53. exp=$(grep -w "^### $user" "/usr/local/shadowsocksr/akun.conf" | cut -d ' ' -f 3)
  54. d1=$(date -d "$exp" +%s)
  55. d2=$(date -d "$now" +%s)
  56. exp2=$(( (d1 - d2) / 86400 ))
  57. if [[ "$exp2" = "0" ]]; then
  58. sed -i "/^### $user $exp/d" "/usr/local/shadowsocksr/akun.conf"
  59. cd /usr/local/shadowsocksr
  60. match_del=$(python mujson_mgr.py -d -u "${user}"|grep -w "delete user")
  61. cd
  62. fi
  63. done
  64. /etc/init.d/ssrmu restart
  65. data=( `cat /var/lib/premium-script/data-user-sstp | grep '^###' | cut -d ' ' -f 2`);
  66. now=`date +"%Y-%m-%d"`
  67. for user in "${data[@]}"
  68. do
  69. exp=$(grep -w "^### $user" "/var/lib/premium-script/data-user-sstp" | cut -d ' ' -f 3)
  70. d1=$(date -d "$exp" +%s)
  71. d2=$(date -d "$now" +%s)
  72. exp2=$(( (d1 - d2) / 86400 ))
  73. if [[ "$exp2" = "0" ]]; then
  74. sed -i "/^### $user $exp/d" "/var/lib/premium-script/data-user-sstp"
  75. sed -i '/^'"$user"'/d' /home/sstp/sstp_account
  76. fi
  77. done
  78. data=( `cat /etc/trojan/akun.conf | grep '^###' | cut -d ' ' -f 2`);
  79. now=`date +"%Y-%m-%d"`
  80. for user in "${data[@]}"
  81. do
  82. exp=$(grep -w "^### $user" "/etc/trojan/akun.conf" | cut -d ' ' -f 3)
  83. d1=$(date -d "$exp" +%s)
  84. d2=$(date -d "$now" +%s)
  85. exp2=$(( (d1 - d2) / 86400 ))
  86. if [[ "$exp2" = "0" ]]; then
  87. sed -i "/^### $user $exp/d" "/etc/trojan/akun.conf"
  88. sed -i '/^,"'"$user"'"$/d' /etc/trojan/config.json
  89. fi
  90. done
  91. systemctl restart trojan
  92. data=( `cat /etc/wireguard/wg0.conf | grep '^### Client' | cut -d ' ' -f 3`);
  93. now=`date +"%Y-%m-%d"`
  94. for user in "${data[@]}"
  95. do
  96. exp=$(grep -w "^### Client $user" "/etc/wireguard/wg0.conf" | cut -d ' ' -f 4)
  97. d1=$(date -d "$exp" +%s)
  98. d2=$(date -d "$now" +%s)
  99. exp2=$(( (d1 - d2) / 86400 ))
  100. if [[ "$exp2" = "0" ]]; then
  101. sed -i "/^### Client $user $exp/,/^AllowedIPs/d" /etc/wireguard/wg0.conf
  102. rm -f "/home/vps/public_html/$user.conf"
  103. fi
  104. done
  105. systemctl restart wg-quick@wg0
  106. data=( `cat /etc/v2ray/config.json | grep '^###' | cut -d ' ' -f 2`);
  107. now=`date +"%Y-%m-%d"`
  108. for user in "${data[@]}"
  109. do
  110. exp=$(grep -w "^### $user" "/etc/v2ray/config.json" | cut -d ' ' -f 3)
  111. d1=$(date -d "$exp" +%s)
  112. d2=$(date -d "$now" +%s)
  113. exp2=$(( (d1 - d2) / 86400 ))
  114. if [[ "$exp2" = "0" ]]; then
  115. sed -i "/^### $user $exp/,/^},{/d" /etc/v2ray/config.json
  116. sed -i "/^### $user $exp/,/^},{/d" /etc/v2ray/none.json
  117. rm -f /etc/v2ray/$user-tls.json /etc/v2ray/$user-none.json
  118. fi
  119. done
  120. systemctl restart v2ray
  121. systemctl restart v2ray@none
  122. data=( `cat /etc/v2ray/vless.json | grep '^###' | cut -d ' ' -f 2`);
  123. now=`date +"%Y-%m-%d"`
  124. for user in "${data[@]}"
  125. do
  126. exp=$(grep -w "^### $user" "/etc/v2ray/vless.json" | cut -d ' ' -f 3)
  127. d1=$(date -d "$exp" +%s)
  128. d2=$(date -d "$now" +%s)
  129. exp2=$(( (d1 - d2) / 86400 ))
  130. if [[ "$exp2" = "0" ]]; then
  131. sed -i "/^### $user $exp/,/^},{/d" /etc/v2ray/vless.json
  132. sed -i "/^### $user $exp/,/^},{/d" /etc/v2ray/vnone.json
  133. fi
  134. done
  135. systemctl restart v2ray@vless
  136. systemctl restart v2ray@vnone
  137. data=( `cat /etc/trojan-go/config.json | grep '^###' | cut -d ' ' -f 2`);
  138. now=`date +"%Y-%m-%d"`
  139. for user in "${data[@]}"
  140. do
  141. exp=$(grep -w "^### $user" "/etc/trojan-go/config.json" | cut -d ' ' -f 3)
  142. d1=$(date -d "$exp" +%s)
  143. d2=$(date -d "$now" +%s)
  144. exp2=$(( (d1 - d2) / 86400 ))
  145. if [[ "$exp2" = "0" ]]; then
  146. sed -i "/^### $user $exp/,/^},{/d" /etc/trojan-go/config.json
  147. fi
  148. done
  149. systemctl restart trojan-go