pid_t pid = already_running();
if (pid) {
if (!force) {
- fatal(0, "%s: already running as pid %ld",
- get_pidfile(), (long int) pid);
+ ofp_fatal(0, "%s: already running as pid %ld",
+ get_pidfile(), (long int) pid);
} else {
VLOG_WARN("%s: %s already running as pid %ld",
get_pidfile(), program_name, (long int) pid);
char c = 0;
int fds[2];
if (pipe(fds) < 0) {
- fatal(errno, "pipe failed");
+ ofp_fatal(errno, "pipe failed");
}
switch (fork()) {
case -1:
/* Error. */
- fatal(errno, "could not fork");
+ ofp_fatal(errno, "could not fork");
break;
}
} else {
}
}
+void
+daemon_usage(void)
+{
+ printf(
+ "\nDaemon options:\n"
+ " -D, --detach run in background as daemon\n"
+ " -P, --pidfile[=FILE] create pidfile (default: %s/%s.pid)\n"
+ " -f, --force with -P, start even if already running\n",
+ RUNDIR, program_name);
+}