ctdb-daemon: CTDB_PIDFILE environment variable overrides default
[samba.git] / ctdb / server / ctdbd.c
index a2534d82a62440e8278ed414004a7f192fa68caf..9341f77d0eab404d8f70f8c0cd18ecf522c92a6f 100644 (file)
@@ -156,7 +156,11 @@ int main(int argc, const char *argv[])
        poptContext pc;
        struct tevent_context *ev;
 
-       ctdbd_pidfile = CTDB_RUNDIR "/ctdbd.pid";
+       /* Environment variable overrides default */
+       ctdbd_pidfile = getenv("CTDB_PIDFILE");
+       if (ctdbd_pidfile == NULL) {
+               ctdbd_pidfile = CTDB_RUNDIR "/ctdbd.pid";
+       }
 
        pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);