You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
839 B
27 lines
839 B
#!/bin/bash |
|
|
|
logDate=$(date '+%Y-%m-%dT%TZ') |
|
logFile="/home/lm-1/logs/start-logs.txt" |
|
|
|
getApiUrl () { |
|
# Copy and Paste for the win! |
|
case $HOSTNAME in |
|
(factory1) apiURL="http://3.9.19.84/api/status/update/1";; |
|
(factory2) apiURL="http://3.9.19.84/api/status/update/2";; |
|
(factory3) apiURL="http://3.9.19.84/api/status/update/3";; |
|
(gallery1) apiURL="http://3.9.19.84/api/status/update/4";; |
|
(gallery2) apiURL="http://3.9.19.84/api/status/update/5";; |
|
(gallery3) apiURL="http://3.9.19.84/api/status/update/6";; |
|
esac |
|
} |
|
|
|
logStatusChange () { |
|
cat << EOF >> $logFile |
|
$logDate |
|
EOF |
|
} |
|
|
|
logStatusChange |
|
getApiUrl |
|
|
|
curl -X POST --header 'Content-Type: application/json' --header 'Accept: text/html' -d '{"status": "on", "time": "'${logDate}'", "token": "QWERTYuiopasdfghjklzxcvbnm_1234567890"}' "${apiURL}"
|
|
|