verifbot 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. [[ ! -d /etc/SSHPlus ]] && exit 0
  3. [[ ! -d /etc/bot/revenda ]] && exit 0
  4. for arq in $(ls /etc/bot/revenda); do
  5. _diasR=$(grep -w 'DIAS_REVENDA' /etc/bot/revenda/$arq/$arq | awk '{print $NF}')
  6. [[ "$_diasR" -eq '0' ]] && {
  7. [[ "$(grep -wc 'SUBREVENDA' /etc/bot/revenda/$arq/$arq)" != '0' ]] && {
  8. while read _listsub3; do
  9. _usub3="$(echo $_listsub3 | awk '{print $2}')"
  10. _dir_users="/etc/bot/revenda/$_usub3/usuarios"
  11. [[ "$(ls $_dir_users | wc -l)" != '0' ]] && {
  12. for _user in $(ls $_dir_users); do
  13. usermod -L $_user
  14. pkill -U $_user
  15. done
  16. }
  17. [[ $(grep -wc $_usub3 /etc/bot/lista_suspensos) == '0' ]] && {
  18. mv /etc/bot/revenda/$_usub3 /etc/bot/suspensos/$_usub3
  19. grep -w "$_usub3" /etc/bot/lista_ativos >>/etc/bot/lista_suspensos
  20. }
  21. done <<<"$(grep -w 'SUBREVENDA' /etc/bot/revenda/$arq/$arq)"
  22. }
  23. [[ "$(ls /etc/bot/revenda/$arq/usuarios | wc -l)" != '0' ]] && {
  24. for _user in $(ls /etc/bot/revenda/$arq/usuarios); do
  25. usermod -L $_user
  26. pkill -U $_user
  27. done
  28. }
  29. [[ $(grep -wc $arq /etc/bot/lista_suspensos) == '0' ]] && {
  30. mv /etc/bot/revenda/$arq /etc/bot/suspensos/$arq
  31. grep -w "$arq" /etc/bot/lista_ativos >>/etc/bot/lista_suspensos
  32. }
  33. } || {
  34. _days=$(($_diasR - 1))
  35. sed -i "/\b$arq\b/ s/DIAS: $_diasR/DIAS: $_days/" /etc/bot/lista_ativos
  36. sed -i "/DIAS_REVENDA/ s/$_diasR/$_days/" /etc/bot/revenda/$arq/$arq
  37. echo $arq $_diasR DIAS ALTERADO PARA $_days
  38. }
  39. done