xp-pptp.sh 508 B

12345678910111213141516
  1. #!/bin/bash
  2. data=( `cat /var/lib/premium-script/data-user-pptp | 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-pptp" | 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-pptp"
  12. sed -i '/^"'"$user"'" pptpd/d' /etc/ppp/chap-secrets
  13. chmod 600 /etc/ppp/chap-secrets*
  14. fi
  15. done