Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
2.3 kB
2
Indexable
Never
ipmi() {
    mysql billing -e "select name,ipmi_ip,ipmi_admin_login,ipmi_admin_pass from servers where name = \"$1\";"
}

backup() {
    mysql billing -e "select name,backup from servers where name = \"$1\";"
}

vps() {
    echo 'noccron-1 DC1 Less than 200 ip in: vps'
    mysql billing -N -e "select sum(free_ip_num) from announces where location_id = 4 AND netpurpose = 'vps' and blocked=0 and ddos_protection=\"N\""
    echo 'noccron-1 DC2 Less than 200 ip in: vps'
    mysql billing -N -e "select sum(free_ip_num) from announces where location_id = 9 AND netpurpose = 'vps' and blocked=0 and ddos_protection=\"N\""
    echo 'noccron-1 DC2 Less than 100 ip in: hosting-personal'
    mysql billing -N -e "select sum(free_ip_num) from announces where location_id = 9 AND netpurpose = 'hosting-personal' and blocked=0 and ddos_protection=\"N\""
}

trans() {
    DATE=$(date +%Y/%m/%d)
    if [[ $1 = 'full' ]]; then
        ssh -q root@sb1 "cat /mnt/log/transfer_account/syscron-1/${DATE}/transfer.log" | less -R
    else
        CUSTOMER=$1
        ssh root@sb1 "tail -f /mnt/log/transfer_account/syscron-1/${DATE}/transfer.log | egrep -i $CUSTOMER"
    fi
}

dos() {
    echo ---[DOMAINS]---
    ssh -q root@sb1 "/var/repo/ddos $1 10000 d" | column -t
    echo
    echo -----[IP]------
    ssh -q root@sb1 "/var/repo/ddos $1 10000 i" | column -t
}

zfs() {
    if [[ $2 = 'list' ]]; then
        ssh -q root@$1 "zfs list && echo '-----' && zfs get reservation zpool/reserved"
    else
        ssh -q root@$1 "zfs userspace -Ho 'name,used' zpool/home | sort -k2 -h | column -t | tail -30"
    fi
}

drop() {
    call_portal $1 Account DropCustomerData -a $2 &
}

fail() {
    ssh -q root@vapi4 'docker exec -i "$(docker ps -q --filter name=sentinel)" python -m vapi_server.control lock list --verbose | grep FAILURE'
}

rel() {
    ssh -q root@vapi4 "docker exec -i \"$(docker ps -q --filter name=sentinel)\" python -m vapi_server.control lock release $1"
}

spool() {
    mysql exim -e "select * from domains where domainname = \"$1\""
}

slow() {
drbd slow
}

check() {
    php=(phpinfo.php53 phpinfo.php54 phpinfo.php56 phpinfo.php71 phpinfo.php72 phpinfo.php73 phpinfo.php74 phpinfo.php80)
    for ver in ${php[@]}; do
        echo -n "${ver^^}: " | sed 's/PHPINFO\.//'
        curl -IL --silent $1.timeweb.ru/${ver} | grep ^HTTP
    done
}