123456789101112131415161718192021222324252627282930313233343536 |
- #!/bin/bash
- NUMBER_OF_CLIENTS=$(grep -c -E "^### " "/etc/v2ray/config.json")
- if [[ ${NUMBER_OF_CLIENTS} == '0' ]]; then
- echo ""
- echo "You have no existing clients!"
- exit 1
- fi
- clear
- echo ""
- echo " Select the existing client you want to remove"
- echo " Press CTRL+C to return"
- echo " ==============================="
- echo " No Expired User"
- grep -E "^### " "/etc/v2ray/config.json" | cut -d ' ' -f 2-3 | nl -s ') '
- until [[ ${CLIENT_NUMBER} -ge 1 && ${CLIENT_NUMBER} -le ${NUMBER_OF_CLIENTS} ]]; do
- if [[ ${CLIENT_NUMBER} == '1' ]]; then
- read -rp "Select one client [1]: " CLIENT_NUMBER
- else
- read -rp "Select one client [1-${NUMBER_OF_CLIENTS}]: " CLIENT_NUMBER
- fi
- done
- user=$(grep -E "^### " "/etc/v2ray/config.json" | cut -d ' ' -f 2 | sed -n "${CLIENT_NUMBER}"p)
- exp=$(grep -E "^### " "/etc/v2ray/config.json" | cut -d ' ' -f 3 | sed -n "${CLIENT_NUMBER}"p)
- 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
- systemctl restart v2ray
- systemctl restart v2ray@none
- clear
- echo " V2RAY Akun berhasil dihapus"
- echo " =========================="
- echo " Client Name : $user"
- echo " Expired On : $exp"
- echo " =========================="
- echo " By TuanYz"
|