Created
April 7, 2014 21:42
-
-
Save digitaljhelms/10063643 to your computer and use it in GitHub Desktop.
DNSimple hostname updater on OS X (prior to Yosemite)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
. /etc/rc.common | |
AUTH_EMAIL='' # dnsimple account email address | |
AUTH_TOKEN='' # dnsimple api token | |
DOMAIN_ID='' # domain name or id | |
RECORD_ID='' # record id to update | |
IP="`curl http://icanhazip.com/`" | |
foo () | |
{ | |
curl -H "X-DNSimple-Token: $AUTH_EMAIL:$AUTH_TOKEN" \ | |
-H "Accept: application/json" \ | |
-H "Content-Type: application/json" \ | |
-X PUT \ | |
-d "{\"record\":{\"content\":\"$IP\"}}" \ | |
https://api.dnsimple.com/v1/domains/$DOMAIN_ID/records/$RECORD_ID | |
} | |
StartService () | |
{ | |
foo | |
} | |
# StopService () | |
# { | |
# } | |
RestartService () | |
{ | |
foo | |
} | |
RunService "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Description</key> | |
<string>DNSimple Dynamic Local IP Updater</string> | |
<key>OrderPreference</key> | |
<string>None</string> | |
<key>Provides</key> | |
<array> | |
<string>DNSimpleUpdater</string> | |
</array> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OS X Yosemite removed the
SystemStarter
executable; this approach has been deprecated and https://gist.github.com/digitaljhelms/a1f1d9e2d8aaa3838571 should be used on systems running OS X Yosemite and higher.