- #!/bin/bash
- 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
|