#Reprint# High-quality American CN2 automatic data center switching script/Use high-quality American CN2 API to automatically switch data centers

888u

Last update at :2024-05-25,Edit by888u

High-quality American CN2 is a well-known VPS seller from the United States. It is a merchant that integrates low price and high performance. At least that is what Snail thinks. Snail has many VPS on hand, and the high-quality American CN2VPS he purchased is Use the one with the highest rating. This year, dual-use high-quality American CN2 launched a powerful 2-core 2G memory promotion plan. The CN2 GT line only costs $29.88 per year, which is very cost-effective. However, the default allocation is DC3 (Los Angeles QN computer room). Some netizens prefer to use DC8 (Los Angeles C3 computer room), but many friends should switch to the DC8 computer room in the control panel operation and prompt "Region is full. Please try again in a few hours." error. This prompt means that the computer room is full. Please operate again later. In fact, Snail has previously shared a script for automatically switching computer rooms in the high-quality American CN2 one-click automatic application to migrate to the DC8 computer room (CN2 GT line). Today, I will share with you a script that uses high-quality CN2 and uses it to create The American CN2API implements automatic switching of computer room scripts. The principle is consistent with the script mentioned by Snail before.

1. Script download

wget --no-check-certificate -qO BWH.sh \'https://moeclub.org/attachment/LinuxShell/BWH.sh\' && chmod a+x BWH.sh

2. Run command

#Run bash BWH.sh in the foreground #Run nohup bash BWH.sh in the background >/dev/null 2>&1 &

3. Script settings

This step is very critical. After downloading the script, we need to edit the script and modify the key data in the following parts.

veid=\'1234560\'; # VEIDapi_key=\'private_xxxxxxxxxxxxxxxxx\'; # API KEYToLocation=\'USCA_8\'; # Target computer room code. Timeout=\'150\'; # API frequency is limited, in seconds. Every Run once every 150 seconds. (It is not recommended to set it too low, otherwise the panel will report an error.)

As for how to modify it, we can modify BWH.sh through the following command, or directly download the file from the server, modify it with Notepad, save it, and then upload it to the server.

vim BWH.sh

1. Obtain veid and api_key information through the API of the control panel, as shown in the figure below. Fill in the information obtained in the quotation marks of '1234560' and 'private_xxxxxxxxxxxxxxxxx'.

2. Obtain ToLocation target computer room code information. First, enter the manual switching computer room page through the control panel. You can view the required computer room code in the picture below.

4. Script code preview

#!/bin/bash veid=\'1234560\';api_key=\'private_xxxxxxxxxxxxxxxxx\';ToLocation=\'USCA_8\';Timeout=\'150\'; # START[[ -n \"$veid\" ]] || exit 1[[ -n \"$api_key\" ]] || exit 1[[ -n \"$ToLocation\" ]] || exit 1[[ -n \"$Timeout\" ]] || exit 1 CurrentLocation=\'\';Token=\"?veid=${veid}&api_key=${api_key}\";API_URL=\"https://api.64clouds.com/v1/\"; while [[ \"$CurrentLocation\" != \"$ToLocation\" ]]; do CurrentLocation=$(wget --no-check-certificate -qO- \"${API_URL}migrate/getLocations${Token}\ " |grep -o \'\"currentLocation\":\"[^\"]*\"\' |cut -d\'\"\' -f4) echo \"$(date +\"[%Y /%m/%d %H:%M:%S]\") ${CurrentLocation}\"; if [ -n \"$CurrentLocation\" -a \"$CurrentLocation\" != \"$ToLocation\ " ]; then echo -n \"${ToLocation}: \" wget --no-check-certificate -qO- \"${API_URL}migrate/start${Token}&location=${ToLocation}\" |grep -o \'\"message\":\"[^\"]*\"\' |cut -d\'\"\' -f4 else break; fi sleep ${Timeout};done

Script from: https://moeclub.org/2018/11/12/680/?v=791

Recommended site searches: Suqian server, asp host cloud server, Ministry of Industry and Information Technology website registration query, Chinese domain name, Hong Kong vpn server, Korean server recommendation, American server, how to apply for a free domain name, Hong Kong ip,

#Reprint# High-quality American CN2 automatic data center switching script/Use high-quality American CN2 API to automatically switch data centers

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码