PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` ## # 01 Подготовка mkdir /etc/scripts/accounting ; cd /etc/scripts/accounting find /var/cpanel/suspended/ -maxdepth 1 -type f -mtime +60 | awk -F"/" '{print $5}' > /etc/scripts/accounting/03.all_users_on_server // след това на ръка се маха от файла -z ако има такова ентри ... клет бъг ## # 02 Отсяване на АКТИВНИ главни(реселърски) акаунти и под акаунтите им # https://my.tmdhosting.com/test/getServerAccounts/Active съберете активните акаунти от whmcs в файл с името 01.whmcs-active for i in `cat /etc/scripts/accounting/01.whmcs-active` ;do whmapi1 resellerstats user=$i | grep user | awk {'print $2'}|sort|uniq;done > /etc/scripts/accounting/02.Active_resellers_and_sub_accs ## # 03 Отсяване на НЕАКТИВНИ главни(реселърски) акаунти и под акаунтите им cat /etc/scripts/accounting/02.Active_resellers_and_sub_accs /etc/scripts/accounting/03.all_users_on_server | sort -n | uniq -c |grep "1 " | awk '{print $2}' > /etc/scripts/accounting/04.Accounts_should_not_be_active ## ##PROVERKA #Pravim fail src.sh s content #BEGIN #!/bin/bash for i in `cat /etc/scripts/accounting/04.Accounts_should_not_be_active`; do TESTACC=`whmapi1 accountsummary user=$i | grep -w suspended: | awk -F":" '{print $2}'` if [[ "$TESTACC" -eq "0" ]]; then echo "$i" fi ##END #Zapazvame outputa v 05.should_suspend_only_this_ones ./src.sh > 05.should_suspend_only_this_ones # 04 Stop exim from sending mails service exim stop chmod -x /usr/sbin/exim ## # 05 Суспенд на всички акаунти от горният списък for i in `cat /etc/scripts/accounting/04.Accounts_should_not_be_active` ; do /scripts/suspendacct $i "User shoud not be active according to WHMCS" ; done ## # 06 Start exim chmod +x /usr/sbin/exim service exim start ## Proverka dali vsichko e tocno predi da zapochnem trieneto # #PRavim fail check.sh sys sledniq content #!/bin/bash for i in `cat /etc/scripts/accounting/02.Active_resellers_and_sub_accs`; do TESTACC=`whmapi1 accountsummary user=$i | grep -w suspended: | awk -F":" '{print $2}'` if [[ "$TESTACC" -eq "1" ]]; then echo "$i" fi ##Izpylqvame sled tova ./check.sh > 06.Check_active_for_suspended ## Vadim vsichkite novi suspended accounti ls /var/cpanel/suspended/ | grep -v ./ >> 07.all_new_suspended_accounts cat 06.Check_active_for_suspended 07.all_new_suspended_accounts |sort -n | uniq -c |grep "2 " | awk '{print $2} > 08.DO_NOT_REMOVE_THOSE ## Ako sledvashtata komanda vyrne samo 1 sme good to go # cat 04.Accounts_should_not_be_active 08.DO_NOT_REMOVE_THOSE | sort -n | uniq -c | sort -n