1
0
Fork 0
A Python based project which measures the light levels of an environment and forwards those measurements on to a server. This project is one of several which forms the software-side of the 'Return to Ritherdon' project.
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 

31 lines
764 B

#!/bin/bash
logDate=$(date '+%Y-%m-%dT%TZ')
logFile="/home/rtrp/logs/shutdown-logs.txt"
mainURL="http://3.9.19.84/api/status/update"
getApiUrl () {
# Copy and Paste for the win!
case $HOSTNAME in
(factory1) apiURL="${mainURL}/1";;
(factory2) apiURL="${mainURL}/2";;
(factory3) apiURL="${mainURL}/3";;
(gallery1) apiURL="${mainURL}/4";;
(gallery2) apiURL="${mainURL}/5";;
(gallery3) apiURL="${mainURL}/6";;
esac
}
logStatusChange () {
cat << EOF >> $logFile
$logDate
EOF
}
logStatusChange
getApiUrl
curl -X POST --header 'Content-Type: application/json' --header 'Accept: text/html' -d '{"status": "off", "time": "'${logDate}'", "token": "QWERTYuiopasdfghjklzxcvbnm_1234567890"}' "${apiURL}"
sleep 5
shutdown now