blog archives and bash scripting
I spent some time updating this site so now blog archives by month are visible to the right side of entries (source on Github). Currently the site is powered by gunicorn via a reverse proxy to nginx under virtualenv on ubuntu-server linux. Deployment is simple as I do a git pull and then restart gunicorn for changes to take effect. However since gunicorn is running as a background daemon process, in laziness I've grepped for gunicorn along with the port number I am running the site on, kill -9 the PID, and then run the daemon process again. Instead of going through Bash history each time I wanted to deploy, I finally wrote a Bash script for this process:
#!/bin/bash
kill `pgrep -f "gunicorn.*8000"`
python manage.py run_gunicorn -b 127.0.0.1:1337 --daemon
First line searches process list for all instances of gunicorn running under port 8000, then passes it to a kill command (-9 not necessary). The second line starts gunicorn server daemon process to start the django site. Simple and effective.