better logging

This commit is contained in:
nicco 2019-01-22 13:04:02 +01:00
parent 9d1a61cf21
commit fcf2a0e1c7

4
run.sh
View File

@ -40,8 +40,6 @@ else
echo "$record_identifier" >> $id_file
fi
echo "Updating $zone_identifier, $record_identifier"
update=$(curl -s -X PUT "https://api.cloudflare.com/client/v4/zones/$zone_identifier/dns_records/$record_identifier" -H "X-Auth-Email: $auth_email" -H "X-Auth-Key: $auth_key" -H "Content-Type: application/json" --data "{\"id\":\"$zone_identifier\",\"type\":\"A\",\"name\":\"$record_name\",\"content\":\"$ip\"}")
if [[ $update == *"\"success\":false"* ]]; then
@ -50,7 +48,7 @@ if [[ $update == *"\"success\":false"* ]]; then
echo -e "$message"
exit 1
else
message="IP changed to: $ip"
message="$(date) - IP changed to: $ip"
echo "$ip" > $ip_file
log "$message"
echo "$message"