bind10 Init Script
ISC release the first release candidate for BIND 10 1.0.0 this week. I decided to give it a try since I've been a fan of ISC BIND and DHCPD for a long time, and BIND 10 plans to bring the two together.
There are plenty of guides on building it out there, but I was unable to find a sysvinit style init script for my Debian needs. I found an upstart example in the Ubuntu 12.04 LTS System Notes on the wiki, but I'm not going to dirty up any Debian box with upstart. Here's what I came up with.
### BEGIN INIT INFO
# Provides: bind10
# Required-Start: networking
# Required-Stop: networking
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop bind10
# Description: bind10 is a Domain Name Server (DNS) with experimental
# DHCPv4 and DHCPv6 server support
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
DAEMON=/usr/local/sbin/bind10
BINDCTL=/usr/local/bin/bindctl
BINDUSER=bind
PIDFILE=/var/run/bind10/bind10.pid
OPTIONS="--user=${BINDUSER} --pid-file=${PIDFILE}"
test -f /etc/default/bind10 && . /etc/default/bind10
. /lib/lsb/init-functions
mkdir -p /var/run/bind10
chown root:bind /var/run/bind10
chmod 775 /var/run/bind10
case "$1" in
start)
log_daemon_msg "Starting domain name service..." "bind10"
if start-stop-daemon --start --oknodo --quiet --background --exec ${DAEMON} -- ${OPTIONS}
then
log_end_msg 0
else
log_end_msg 1
fi
;;
stop)
log_daemon_msg "Stopping domain name service..." "bind10"
start-stop-daemon --stop --oknodo --quiet --pidfile ${PIDFILE}
log_end_msg 0
;;
restart)
$0 stop
$0 start
;;
status)
ret=0
status_of_proc -p /var/run/bind10/bind10.pid /usr/local/libexec/bind10/b10-init bind10 2>/dev/null || ret=$?
exit $ret
;;
*)
log_action_msg "Usage: /etc/init.d/bind10 {start|stop|restart|status}"
exit 1
;;
esac
exit 0
Assuming you installed bind10 under the default prefix of /usr/local, you should be able to copy and paste that into /etc/init.d/bind10, then run the following:
sudo chmod +x /etc/init.d/bind10
sudo update-rc.d bind10 defaults
sudo service bind10 startYou'll still need to follow the steps in the BIND 10 Guide to get things going, but the starting and stopping was something I had to get sorted before I got any farther into the setup process.
Cobbler, uWSGI, and Nginx
I know. The title sounds like crazy talk. Why would you want to run Cobbler with uWSGI under Nginx? Well, I inherited a box that was already setup with Nginx and had Graphite running via uWSGI, so I wasn't going to be the one setup Nginx to proxy to Apache.
Why not just run the perfectly good WSGI services Cobbler has directly? Well, Nginx's mod_wsgi module is old and busted. It does, however, have support for the uWSGI protocol, and the uWSGI application server runs WSGI apps similarly to how you would use mod_wsgi in Apache. You end up with a leaner setup than you would probably get from a similar Apache config.
Dynamic Rackspace DNS updater script
I've been maintaining my own DNS servers for a long time. In an effort to streamline my life, I've decided to move my DNS to Rackspace. I have a record for my home IP that I've updated manually for a couple of years. While I could have written a script to do this with BIND, I just never got around to it. Part of the reason I decided to move my DNS to Rackspace so I didn't have to maintain another server (I have enough at work to worry about) and they have an API for managing your zones.
To make updating my home DNS more streamlined, I wrote a quick script last night to handle updating the DNS record I keep for my home IP, which is dynamic. You can find it here on Github.
While I included a small Flask app to be hosted on a remote system to give you your local public IP, you're free to use mine. For IPv4 addresses, use http://ipv4.dndy.me/, and for IPv6, http://ipv6.dndy.me/. The updater script is smart enough to determine whether an A or AAAA record should be updated based on what it gets back from the IP service.
Chromium easy update
Update: The URL's no longer work, so this is busted. I've gone back to Firefox since 4.0 came out. It is heavier than Chrom(e|ium), but I was finding that there were some features I was really missing. As such, this still can serve as the basis for an update if given the correct URL's.
I'm a bleeding edge kind of guy. No, I'm not. When it comes to software, I'm generally a bleeding edge kind of guy. I really like Chromium. I hate going to the Chromium build site, downloading it, closing my browser, then moving it in place. I'm a lazy admin.
Here's a couple quick-n-dirty bash script that retrieves the latest Chromium build.
Mac Version
Special Notes:
#!/bin/bash echo -n "Retrieving latest build: " VER=$( curl -s http://build.chromium.org/f/chromium/snapshots/chromium-rel-mac/LATEST ) echo "$VER" TMPDIR=$( mktemp -d /tmp/chromium.XXXXX ) echo "Downloading Chromium: " curl -o ${TMPDIR}/chromium.zip http://build.chromium.org/f/chromium/snapshots/chromium-rel-mac/${VER}/chrome-mac.zip echo -n "Decompressing archive: " unzip -qqx ${TMPDIR}/chromium -d ${TMPDIR} echo "done" rm -rf /Applications/Chromium.app mv ${TMPDIR}/chrome-mac/Chromium.app /Applications/ rm -rf ${TMPDIR} echo "New Chromium installed!" |
Linux Version
Special Notes:
#!/bin/bash echo -n "Retrieving latest build: " VER=$( curl -s http://build.chromium.org/f/chromium/snapshots/chromium-rel-linux-64/LATEST ) echo "$VER" TMPDIR=$( mktemp -d /tmp/chromium.XXXXX ) echo "Downloading Chromium: " curl -o ${TMPDIR}/chrome-linux.zip http://build.chromium.org/f/chromium/snapshots/chromium-rel-linux-64/${VER}/chrome-linux.zip echo -n "Decompressing archive: " 7z x -tzip -o${TMPDIR} ${TMPDIR}/chrome-linux.zip > /dev/null echo "done" if [ -d /opt/chrome-linux.1 ] then rm -rf /opt/chrome-linux.1 fi if [ -d /opt/chrome-linux ] then mv /opt/chrome-linux /opt/chrome-linux.1 fi mv ${TMPDIR}/chrome-linux /opt/ find /opt/chrome-linux -type d -exec chmod 2775 {} \; find /opt/chrome-linux -type f -perm /100 -exec chmod 775 {} \; find /opt/chrome-linux -type f ! -perm /100 -exec chmod 664 {} \; chgrp -R opt /opt/chrome-linux rm -rf ${TMPDIR} echo "New Chromium installed!" |
Enjoy!
8 Nov 2010: Updated to match new URLs being used
MacPorts “PortIndex file may be corrupt” Resolution
In the past few months, I moved to a Mac, which has been great. Shortly after switching, I found MacPorts, which has also been great. The other day, however, when doing an upgrade, I got the following warning over and over and my upgrade wouldn't complete:
Warning: It looks like your PortIndex file for rsync://rsync.macports.org/release/ports/ may be corrupt.
I couldn't find a clear answer on what was going on, until I found a bug report on the MacPorts site. The fix for this will be put into MacPorts 1.9.0, but I'm on 1.8.2 now, so that doesn't help much.
The issue sounds like it has to do with a cache of the PortIndex can build up stale information. My brute force resolution was to remove that cache. I wasn't terribly sure where that was, but I did find it.
$ locate PortIndex.quick
/opt/local/var/macports/sources/rsync.macports.org/release/ports/PortIndex.quick
$ sudo rm /opt/local/var/macports/sources/rsync.macports.org/release/ports/PortIndex.quick
Alternatively, you could move the file out of the way if that makes you more comfortable.
Once that was done, I went ahead and gave it try.
$ sudo port sync
Warning: No quick index file found, attempting to generate one for source: rsync://rsync.macports.org/release/ports/
$ sudo port upgrade outdated
...
All worked as it should! So until we see MacPorts 1.9.0, this will be my solution should I see this come up again.