PID management for twanager server

I frequently find myself writing scripts like this:

    #!/usr/bin/env sh

    set -e

    if [ -f "server.pid" ]; then
        kill `cat server.pid` || true
        rm server.pid
    fi

    if [ "$1" = "-q" ]; then
        exit 0
    fi

    twanager server &
    echo "$!" > server.pid

it seemed like `twanager server` might as well (optionally) take care of this itself