自动刷甲骨文免费VPS脚本(支持推送)

主要是增加了推送,需要安装 oci,支持请求统计。 需要自行注册使用 https://www.stathat.com/ 甲骨文官网:https://www.oracle.com/index.html 请输入图片描述

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
export PATH=/home/name/bin:$PATH

[[ -e "/home/name/lib/oracle-cli/lib/python2.7/site-packages/oci_cli/bin/oci_autocomplete.sh" ]] && source "/home/name/lib/oracle-cli/lib/python2.7/site-packages/oci_cli/bin/oci_autocomplete.sh"

log_path='/root/oracle.log' # log dir
python_version='3' #Python by default
# stat_user='mail@mail.com'
# stat_project='Oracle KR'

response=$(/root/bin/oci compute instance launch\
    --availability-domain kWIa:AP-SEOUL-1-AD-1\
    --image-id ocid1.image.oc1.ap-seoul-1.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
    --subnet-id ocid1.subnet.oc1.ap-seoul-1.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
    --shape VM.Standard.E2.1.Micro\
    --assign-public-ip true\
    --metadata '{"ssh_authorized_keys": "ssh-rsa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/kDme8T+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa+Y/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa== rsa 2048-091719"}'\
--compartment-id ocid1.tenancy.oc1..aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 2>&1)

# echo 'Variable'
# echo ${response}

status=$(python${python_version} -c "import sys, json; print(json.loads(' '.join(sys.argv[1:])[13:])['status'])" ${response})
message=$(python${python_version} -c "import sys, json; print(json.loads(' '.join(sys.argv[1:])[13:])['message'])" ${response})
request_id=$(python${python_version} -c "import sys, json; print(json.loads(' '.join(sys.argv[1:])[13:])['opc-request-id'])" ${response})
# curl -d "stat=${stat_project}&ezkey=${stat_user}&count=1" http://api.stathat.com/ez

if [ $status != 500 ]
then
    curl -G 'https://tgbot.lbyczf.com/sendMessage/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' --data-urlencode "text=${message}" # push to tg
fi
echo ${status} ${message}
坚持原创技术分享,您的支持将鼓励我继续创作!