Write pidfile on startup