server/bin: clean up bash scripts

This is mostly adding set -e and quoting variables.