Advertisement
xangin

Earthquake shell script

Jan 31st, 2023 (edited)
916
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.65 KB | None | 0 0
  1. #!/bin/bash
  2. #將全部內容複製後,另存為ea.sh,之後在地牛wake up中選擇此檔案執行,
  3. #需要先安裝curl指令:sudo apt install curl
  4. #HA的IP:PORT,注意等號左右不能有空格唷!!
  5. DST=http://192.168.xxx.xxx:8123
  6.  
  7. #在HA內建立一個token(左下角你的名字上面點一下並拉到最下面,新增永久有效存取權杖),注意等號左右不能有空格唷!!
  8. TOKEN=xxxxx
  9.  
  10. #要執行腳本的名稱
  11. SCRIPT=earthquake_alert
  12.  
  13. curl -s -k -X POST -H "Authorization: Bearer $TOKEN" \
  14.   -H "Content-Type: application/json" \
  15.   -d "{ \"level\": \"$1\" , \"seconds\": \"$2\" }" \
  16.   $DST/api/services/script/$SCRIPT
  17.  
Tags: ha
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement