projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make -P or --pidfile keep programs from running if already running.
[openvswitch]
/
controller
/
controller.c
diff --git
a/controller/controller.c
b/controller/controller.c
index 01037bbb0d93851ec37b2ef6df14f8e14292f61e..2d79afaa4fd58bb4c06c16bd73fc5ea1119c2572 100644
(file)
--- a/
controller/controller.c
+++ b/
controller/controller.c
@@
-133,6
+133,7
@@
main(int argc, char *argv[])
fatal(0, "no active or passive switch connections");
}
fatal(0, "no active or passive switch connections");
}
+ die_if_already_running();
daemonize();
while (n_switches > 0 || n_listeners > 0) {
daemonize();
while (n_switches > 0 || n_listeners > 0) {
@@
-231,6
+232,7
@@
parse_options(int argc, char *argv[])
static struct option long_options[] = {
{"detach", no_argument, 0, 'D'},
{"pidfile", optional_argument, 0, 'P'},
static struct option long_options[] = {
{"detach", no_argument, 0, 'D'},
{"pidfile", optional_argument, 0, 'P'},
+ {"force", no_argument, 0, 'f'},
{"hub", no_argument, 0, 'H'},
{"noflow", no_argument, 0, 'n'},
{"max-idle", required_argument, 0, OPT_MAX_IDLE},
{"hub", no_argument, 0, 'H'},
{"noflow", no_argument, 0, 'n'},
{"max-idle", required_argument, 0, OPT_MAX_IDLE},
@@
-260,6
+262,10
@@
parse_options(int argc, char *argv[])
set_pidfile(optarg);
break;
set_pidfile(optarg);
break;
+ case 'f':
+ ignore_existing_pidfile();
+ break;
+
case 'H':
learn_macs = false;
break;
case 'H':
learn_macs = false;
break;
@@
-314,6
+320,7
@@
usage(void)
printf("\nOther options:\n"
" -D, --detach run in background as daemon\n"
" -P, --pidfile[=FILE] create pidfile (default: %s/controller.pid)\n"
printf("\nOther options:\n"
" -D, --detach run in background as daemon\n"
" -P, --pidfile[=FILE] create pidfile (default: %s/controller.pid)\n"
+ " -f, --force with -P, start even if already running\n"
" -H, --hub act as hub instead of learning switch\n"
" -n, --noflow pass traffic, but don't add flows\n"
" --max-idle=SECS max idle time for new flows\n"
" -H, --hub act as hub instead of learning switch\n"
" -n, --noflow pass traffic, but don't add flows\n"
" --max-idle=SECS max idle time for new flows\n"