mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2025-10-04 00:31:15 +00:00
main: support lock pid file arg
This patch adds support to change the default corosync pid file lock path. This is useful to run corosync net namespace environment only and since the pid lock file cannot be clarified over the conf because the pid lock file exists before config parsing we allow the user to specify it over the command line. Signed-off-by: Alexander Aring <aahringo@redhat.com> Reviewed-by: Jan Friesse <jfriesse@redhat.com>
This commit is contained in:
parent
9bcde28dbe
commit
53730fa7bd
15
exec/main.c
15
exec/main.c
@ -163,7 +163,7 @@ struct sched_param global_sched_param;
|
||||
|
||||
static corosync_timer_handle_t corosync_stats_timer_handle;
|
||||
|
||||
static const char *corosync_lock_file = LOCALSTATEDIR"/run/corosync.pid";
|
||||
static char corosync_lock_file[PATH_MAX + 1] = LOCALSTATEDIR"/run/corosync.pid";
|
||||
|
||||
static char corosync_config_file[PATH_MAX + 1] = COROSYSCONFDIR "/corosync.conf";
|
||||
|
||||
@ -1302,7 +1302,7 @@ int main (int argc, char **argv, char **envp)
|
||||
background = 1;
|
||||
testonly = 0;
|
||||
|
||||
while ((ch = getopt (argc, argv, "c:ftv")) != EOF) {
|
||||
while ((ch = getopt (argc, argv, "c:l:ftv")) != EOF) {
|
||||
|
||||
switch (ch) {
|
||||
case 'c':
|
||||
@ -1315,6 +1315,16 @@ int main (int argc, char **argv, char **envp)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
res = snprintf(corosync_lock_file, sizeof(corosync_lock_file), "%s", optarg);
|
||||
if (res >= sizeof(corosync_lock_file)) {
|
||||
fprintf (stderr, "PID lock file path too long.\n");
|
||||
syslog (LOGSYS_LEVEL_ERROR, "PID lock file path too long.");
|
||||
|
||||
logsys_system_fini();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
break;
|
||||
case 'f':
|
||||
background = 0;
|
||||
break;
|
||||
@ -1331,6 +1341,7 @@ int main (int argc, char **argv, char **envp)
|
||||
fprintf(stderr, \
|
||||
"usage:\n"\
|
||||
" -c : Corosync config file path.\n"\
|
||||
" -l : Corosync pid lock file path.\n"\
|
||||
" -f : Start application in foreground.\n"\
|
||||
" -t : Test configuration and exit.\n"\
|
||||
" -v : Display version, git revision and some useful information about Corosync and exit.\n");
|
||||
|
@ -47,6 +47,14 @@ as a base directory for uidgid files.
|
||||
|
||||
The default is /etc/corosync/corosync.conf.
|
||||
.TP
|
||||
.B -l
|
||||
This specifies the fully qualified path to the corosync pid lock file.
|
||||
|
||||
The default is /var/run/corosync.pid.
|
||||
|
||||
WARNING: This option is not intended for running multiple Corosync instances.
|
||||
Use it only if you know what you are doing.
|
||||
.TP
|
||||
.B -f
|
||||
Start application in foreground.
|
||||
.TP
|
||||
|
Loading…
Reference in New Issue
Block a user