Add pid file and signal handler.