renew.sh 1021 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. read -p " Username : " User
  3. egrep "^$User" /etc/passwd >/dev/null
  4. if [ $? -eq 0 ]; then
  5. read -p " Day Extend : " Days
  6. Today=`date +%s`
  7. Days_Detailed=$(( $Days * 86400 ))
  8. Expire_On=$(($Today + $Days_Detailed))
  9. Expiration=$(date -u --date="1970-01-01 $Expire_On sec GMT" +%Y/%m/%d)
  10. Expiration_Display=$(date -u --date="1970-01-01 $Expire_On sec GMT" '+%d %b %Y')
  11. passwd -u $User
  12. usermod -e $Expiration $User
  13. egrep "^$User" /etc/passwd >/dev/null
  14. echo -e "$Pass\n$Pass\n"|passwd $User &> /dev/null
  15. clear
  16. echo -e "✅DONE RENEW ACCOUNT, TERIMA KASIH YA"
  17. echo -e "========================================"
  18. echo -e " Username : $User"
  19. echo -e " Days Added : $Days Days"
  20. echo -e " Expires on : $Expiration_Display"
  21. echo -e "========================================"
  22. else
  23. clear
  24. echo -e ""
  25. echo -e "======================================"
  26. echo -e ""
  27. echo -e " Username Doesnt Exist "
  28. echo -e ""
  29. echo -e "======================================"
  30. fi