123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- #!/bin/bash
- data=( `cat /var/lib/premium-script/data-user-l2tp | grep '^###' | cut -d ' ' -f 2`);
- now=`date +"%Y-%m-%d"`
- for user in "${data[@]}"
- do
- exp=$(grep -w "^### $user" "/var/lib/premium-script/data-user-l2tp" | cut -d ' ' -f 3)
- d1=$(date -d "$exp" +%s)
- d2=$(date -d "$now" +%s)
- exp2=$(( (d1 - d2) / 86400 ))
- if [[ "$exp2" = "0" ]]; then
- sed -i "/^### $user $exp/d" "/var/lib/premium-script/data-user-l2tp"
- sed -i '/^"'"$user"'" l2tpd/d' /etc/ppp/chap-secrets
- sed -i '/^'"$user"':\$1\$/d' /etc/ipsec.d/passwd
- chmod 600 /etc/ppp/chap-secrets* /etc/ipsec.d/passwd*
- fi
- done
- data=( `cat /var/lib/premium-script/data-user-pptp | grep '^###' | cut -d ' ' -f 2`);
- now=`date +"%Y-%m-%d"`
- for user in "${data[@]}"
- do
- exp=$(grep -w "^### $user" "/var/lib/premium-script/data-user-pptp" | cut -d ' ' -f 3)
- d1=$(date -d "$exp" +%s)
- d2=$(date -d "$now" +%s)
- exp2=$(( (d1 - d2) / 86400 ))
- if [[ "$exp2" = "0" ]]; then
- sed -i "/^### $user $exp/d" "/var/lib/premium-script/data-user-pptp"
- sed -i '/^"'"$user"'" pptpd/d' /etc/ppp/chap-secrets
- chmod 600 /etc/ppp/chap-secrets*
- fi
- done
- data=( `cat /etc/shadowsocks-libev/akun.conf | grep '^###' | cut -d ' ' -f 2`);
- now=`date +"%Y-%m-%d"`
- for user in "${data[@]}"
- do
- exp=$(grep -w "^### $user" "/etc/shadowsocks-libev/akun.conf" | cut -d ' ' -f 3)
- d1=$(date -d "$exp" +%s)
- d2=$(date -d "$now" +%s)
- exp2=$(( (d1 - d2) / 86400 ))
- if [[ "$exp2" = "0" ]]; then
- sed -i "/^### $user $exp/,/^port_http/d" "/etc/shadowsocks-libev/akun.conf"
- systemctl disable shadowsocks-libev-server@$user-tls.service
- systemctl disable shadowsocks-libev-server@$user-http.service
- systemctl stop shadowsocks-libev-server@$user-tls.service
- systemctl stop shadowsocks-libev-server@$user-http.service
- rm -f "/etc/shadowsocks-libev/$user-tls.json"
- rm -f "/etc/shadowsocks-libev/$user-http.json"
- fi
- done
- data=( `cat /usr/local/shadowsocksr/akun.conf | grep '^###' | cut -d ' ' -f 2`);
- now=`date +"%Y-%m-%d"`
- for user in "${data[@]}"
- do
- exp=$(grep -w "^### $user" "/usr/local/shadowsocksr/akun.conf" | cut -d ' ' -f 3)
- d1=$(date -d "$exp" +%s)
- d2=$(date -d "$now" +%s)
- exp2=$(( (d1 - d2) / 86400 ))
- if [[ "$exp2" = "0" ]]; then
- sed -i "/^### $user $exp/d" "/usr/local/shadowsocksr/akun.conf"
- cd /usr/local/shadowsocksr
- match_del=$(python mujson_mgr.py -d -u "${user}"|grep -w "delete user")
- cd
- fi
- done
- /etc/init.d/ssrmu restart
- data=( `cat /var/lib/premium-script/data-user-sstp | grep '^###' | cut -d ' ' -f 2`);
- now=`date +"%Y-%m-%d"`
- for user in "${data[@]}"
- do
- exp=$(grep -w "^### $user" "/var/lib/premium-script/data-user-sstp" | cut -d ' ' -f 3)
- d1=$(date -d "$exp" +%s)
- d2=$(date -d "$now" +%s)
- exp2=$(( (d1 - d2) / 86400 ))
- if [[ "$exp2" = "0" ]]; then
- sed -i "/^### $user $exp/d" "/var/lib/premium-script/data-user-sstp"
- sed -i '/^'"$user"'/d' /home/sstp/sstp_account
- fi
- done
- data=( `cat /etc/trojan/akun.conf | grep '^###' | cut -d ' ' -f 2`);
- now=`date +"%Y-%m-%d"`
- for user in "${data[@]}"
- do
- exp=$(grep -w "^### $user" "/etc/trojan/akun.conf" | cut -d ' ' -f 3)
- d1=$(date -d "$exp" +%s)
- d2=$(date -d "$now" +%s)
- exp2=$(( (d1 - d2) / 86400 ))
- if [[ "$exp2" = "0" ]]; then
- sed -i "/^### $user $exp/d" "/etc/trojan/akun.conf"
- sed -i '/^,"'"$user"'"$/d' /etc/trojan/config.json
- fi
- done
- systemctl restart trojan
- data=( `cat /etc/wireguard/wg0.conf | grep '^### Client' | cut -d ' ' -f 3`);
- now=`date +"%Y-%m-%d"`
- for user in "${data[@]}"
- do
- exp=$(grep -w "^### Client $user" "/etc/wireguard/wg0.conf" | cut -d ' ' -f 4)
- d1=$(date -d "$exp" +%s)
- d2=$(date -d "$now" +%s)
- exp2=$(( (d1 - d2) / 86400 ))
- if [[ "$exp2" = "0" ]]; then
- sed -i "/^### Client $user $exp/,/^AllowedIPs/d" /etc/wireguard/wg0.conf
- rm -f "/home/vps/public_html/$user.conf"
- fi
- done
- systemctl restart wg-quick@wg0
- data=( `cat /etc/v2ray/config.json | grep '^###' | cut -d ' ' -f 2`);
- now=`date +"%Y-%m-%d"`
- for user in "${data[@]}"
- do
- exp=$(grep -w "^### $user" "/etc/v2ray/config.json" | cut -d ' ' -f 3)
- d1=$(date -d "$exp" +%s)
- d2=$(date -d "$now" +%s)
- exp2=$(( (d1 - d2) / 86400 ))
- if [[ "$exp2" = "0" ]]; then
- sed -i "/^### $user $exp/,/^},{/d" /etc/v2ray/config.json
- sed -i "/^### $user $exp/,/^},{/d" /etc/v2ray/none.json
- rm -f /etc/v2ray/$user-tls.json /etc/v2ray/$user-none.json
- fi
- done
- systemctl restart v2ray
- systemctl restart v2ray@none
- data=( `cat /etc/v2ray/vless.json | grep '^###' | cut -d ' ' -f 2`);
- now=`date +"%Y-%m-%d"`
- for user in "${data[@]}"
- do
- exp=$(grep -w "^### $user" "/etc/v2ray/vless.json" | cut -d ' ' -f 3)
- d1=$(date -d "$exp" +%s)
- d2=$(date -d "$now" +%s)
- exp2=$(( (d1 - d2) / 86400 ))
- if [[ "$exp2" = "0" ]]; then
- sed -i "/^### $user $exp/,/^},{/d" /etc/v2ray/vless.json
- sed -i "/^### $user $exp/,/^},{/d" /etc/v2ray/vnone.json
- fi
- done
- systemctl restart v2ray@vless
- systemctl restart v2ray@vnone
- data=( `cat /etc/trojan-go/config.json | grep '^###' | cut -d ' ' -f 2`);
- now=`date +"%Y-%m-%d"`
- for user in "${data[@]}"
- do
- exp=$(grep -w "^### $user" "/etc/trojan-go/config.json" | cut -d ' ' -f 3)
- d1=$(date -d "$exp" +%s)
- d2=$(date -d "$now" +%s)
- exp2=$(( (d1 - d2) / 86400 ))
- if [[ "$exp2" = "0" ]]; then
- sed -i "/^### $user $exp/,/^},{/d" /etc/trojan-go/config.json
- fi
- done
- systemctl restart trojan-go
|