summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2016-10-19 18:17:08 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2016-10-19 18:19:02 +0200
commit0d74c14fd19adcf87103b1fc8815c1901ea9f67a (patch)
tree84f90423a57679f6e5aa796f48f0d703a91b2508
parent095576b945abee99ad4bcbd9f2e35f3137c22304 (diff)
downloadcalcurse-0d74c14fd19adcf87103b1fc8815c1901ea9f67a.tar.gz
calcurse-0d74c14fd19adcf87103b1fc8815c1901ea9f67a.zip
Do not start the daemon more than once
Avoid starting multiple daemon instances if the --daemon argument is passed and the daemon is already running. Terminate the already running instance before spawning a new one instead. Suggested-by: Vlad Glagolev <scm@vaygr.net> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
-rw-r--r--doc/calcurse.1.txt2
-rw-r--r--doc/manual.txt4
-rw-r--r--src/args.c1
3 files changed, 4 insertions, 3 deletions
diff --git a/doc/calcurse.1.txt b/doc/calcurse.1.txt
index 6909808..2129350 100644
--- a/doc/calcurse.1.txt
+++ b/doc/calcurse.1.txt
@@ -97,7 +97,7 @@ today, tomorrow, and the day after tomorrow. The first form is equivalent to
appointments can be specified using the *-c* flag.
*--daemon*::
- Start calcurse in background mode.
+ Start calcurse in background mode. Restart if the daemon was already running.
*--days* <num>::
Specify the length of the range (in days) when used with *-Q*. Cannot be
diff --git a/doc/manual.txt b/doc/manual.txt
index 3883a55..407b63b 100644
--- a/doc/manual.txt
+++ b/doc/manual.txt
@@ -201,8 +201,8 @@ Note: as for the `-a` flag, the calendar from which to read the appointments
can be specified using the `-c` flag.
`--daemon`::
- Start calcurse in background mode. See <<basics_daemon,Background mode>> for
- details.
+ Start calcurse in background mode. Restart if the daemon was already running.
+ See <<basics_daemon,Background mode>> for details.
`--days <num>`::
Specify the length of the range (in days) when used with `-Q`. Cannot be
diff --git a/src/args.c b/src/args.c
index afb4bfc..f4eaba7 100644
--- a/src/args.c
+++ b/src/args.c
@@ -803,6 +803,7 @@ int parse_args(int argc, char **argv)
io_export_data(xfmt, export_uid);
} else if (daemon) {
notify_init_vars();
+ dmon_stop();
dmon_start(0);
} else {
/* interactive mode */