Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
DNSimple hostname updater on OS X (prior to Yosemite)
#!/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"
<?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>
@digitaljhelms

This comment has been minimized.

Copy link
Owner Author

@digitaljhelms digitaljhelms commented May 27, 2015

  1. Fork this gist
  2. Edit variables
  3. cd /Library/StartupItems
  4. Clone fork to a directory named "DNSimpleUpdater"
  5. sudo /sbin/SystemStarter start "DNSimpleUpdater"
  6. Verify results on DNSimple website
@digitaljhelms

This comment has been minimized.

Copy link
Owner Author

@digitaljhelms digitaljhelms commented May 27, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment