Skip to content

Instantly share code, notes, and snippets.

@koron
Last active August 29, 2015 14:24
Show Gist options
  • Save koron/6bd3eaaac15b98947b2d to your computer and use it in GitHub Desktop.
Save koron/6bd3eaaac15b98947b2d to your computer and use it in GitHub Desktop.
update mydnsjp entry.
#!/bin/sh
# vim:set sts=2 sw=2 tw=0 et:
(
export LANG=C
export PATH="/usr/local/bin:${PATH}"
id="$1" ; shift
passwd="$1" ; shift
url="http://www.mydns.jp/login.html"
curl -sfi "$url" -u "${id}:${passwd}" >/dev/null 2>&1
if [ $? != 0 ] ; then
tmpfile=$(mktemp /tmp/mydns-update.XXXXXX)
curl -vsi "$url" -u "${id}:${passwd}" >"$tmpfile" 2>&1
if [ $? != 0 ] ; then
echo "ERROR: $0 failed"
cat "$tmpfile"
fi
rm -f "$tmpfile"
fi
)
$ mydnsjp-update mydns999999 MyPassw0rd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment