autofs-5.0.3 - add command line option to override is running check From: Ian Kent autofs common usage is to have a single instance of the daemon running and it checks for this and exits if another instance is found to be running. But there are situations were people need to run multiple instances and this patch adds a command line option to overrid the check. Please note that this doesn't mean that autofs will function properly and it is the users responsibility to check that the configuration in use will function properly. --- CHANGELOG | 1 + daemon/automount.c | 14 +++++++++++--- man/automount.8 | 10 ++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 5901c75..f40a941 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -23,6 +23,7 @@ - fix direct mount path length not being checked. - fix incorrect if check in get user info. - fix couple of memory leaks. +- add command line option to override check for daemon already running. 14/01/2008 autofs-5.0.3 ----------------------- diff --git a/daemon/automount.c b/daemon/automount.c index 7ce9828..48ac30a 100644 --- a/daemon/automount.c +++ b/daemon/automount.c @@ -1694,6 +1694,8 @@ static void usage(void) " specify global mount options\n" " -l --set-log-priority priority path [path,...]\n" " set daemon log verbosity\n" + " -C --dont-check-daemon\n" + " don't check if daemon is already running\n" " -V --version print version, build config and exit\n" , program); } @@ -1814,7 +1816,7 @@ int main(int argc, char *argv[]) { int res, opt, status; int logpri = -1; - unsigned ghost, logging; + unsigned ghost, logging, daemon_check; unsigned foreground, have_global_options; time_t timeout; time_t age = time(NULL); @@ -1833,6 +1835,7 @@ int main(int argc, char *argv[]) {"global-options", 1, 0, 'O'}, {"version", 0, 0, 'V'}, {"set-log-priority", 1, 0, 'l'}, + {"dont-check-daemon", 0, 0, 'C'}, {0, 0, 0, 0} }; @@ -1851,9 +1854,10 @@ int main(int argc, char *argv[]) global_options = NULL; have_global_options = 0; foreground = 0; + daemon_check = 1; opterr = 0; - while ((opt = getopt_long(argc, argv, "+hp:t:vdD:fVrO:l:n:", long_options, NULL)) != EOF) { + while ((opt = getopt_long(argc, argv, "+hp:t:vdD:fVrO:l:n:C", long_options, NULL)) != EOF) { switch (opt) { case 'h': usage(); @@ -1922,6 +1926,10 @@ int main(int argc, char *argv[]) } break; + case 'C': + daemon_check = 0; + break; + case '?': case ':': printf("%s: Ambiguous or unknown options\n", program); @@ -1965,7 +1973,7 @@ int main(int argc, char *argv[]) exit(exit_code); } - if (is_automount_running() > 0) { + if (daemon_check && is_automount_running() > 0) { fprintf(stderr, "%s: program is already running.\n", program); exit(1); diff --git a/man/automount.8 b/man/automount.8 index 59ad50e..d9285bf 100644 --- a/man/automount.8 +++ b/man/automount.8 @@ -81,6 +81,9 @@ be disabled, returning the daemon to verbose logging. .P The \fIpath\fP argument corresponds to the automounted path name as specified in the master map. +.TP +.I "\-C, \-\-dont-check-daemon" +Don't check if the daemon is currently running (see NOTES). .SH ARGUMENTS \fBautomount\fP takes one optional argument, the name of the master map to use. @@ -122,6 +125,13 @@ until they are no longer in use by the processes that held them busy. If automount managed filesystems are found mounted when autofs is started they will be recoverd unless they are no longer present in the map in which case they need to umounted manually. +.P +If the option to disable the check to see if the daemon is already +running is used be aware that autofs currently may not function correctly +for certain types of automount maps. The mounts of the seperate daemons +might interfere with one another. The implications of running multiple +daemon instances needs to be checked and tested before we can say this +is supported. .SH "SEE ALSO" .BR autofs (5), .BR autofs (8),