summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--daemon.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/daemon.c b/daemon.c
index c873e8a..3fff805 100644
--- a/daemon.c
+++ b/daemon.c
@@ -179,6 +179,14 @@ static void parseInterval(const char *millis) {
 	restartInterval.tv_nsec = 1000000 * (ms % 1000);
 }
 
+static void setTitle(void) {
+	size_t started = 0;
+	for (size_t i = 0; i < services.len; ++i) {
+		if (services.ptr[i].state == Start) started++;
+	}
+	setproctitle("%zu/%zu services", started, services.len);
+}
+
 int main(int argc, char *argv[]) {
 	setprogname(argv[0]);
 
@@ -284,8 +292,7 @@ int main(int argc, char *argv[]) {
 	for (size_t i = 0; i < services.len; ++i) {
 		serviceStart(&services.ptr[i]);
 	}
-
-	// TODO: setproctitle to number of services currently running.
+	setTitle();
 
 	sigset_t mask;
 	sigemptyset(&mask);
@@ -359,6 +366,7 @@ int main(int argc, char *argv[]) {
 					serviceStart(service);
 				}
 			}
+			setTitle();
 		}
 
 		if (signals[SIGCHLD]) {
@@ -368,6 +376,7 @@ int main(int argc, char *argv[]) {
 				serviceReap(pid, status);
 			}
 			if (pid < 0 && errno != ECHILD) syslog(LOG_WARNING, "waitpid: %m");
+			setTitle();
 			signals[SIGCHLD] = 0;
 		}
 
@@ -388,6 +397,7 @@ int main(int argc, char *argv[]) {
 	close(fifo);
 	unlink(fifoPath);
 
+	setproctitle("stopping");
 	size_t count = 0;
 	for (size_t i = 0; i < services.len; ++i) {
 		serviceStop(&services.ptr[i]);
77b47473ff290dc4f&follow=1'>Join with USING wherever possibleJune McEnroe 2019-12-30Add -D flag to prospective scoop manualJune McEnroe 2019-12-30Order results by ID in outer query in litterboxJune McEnroe 2019-12-30Use X macro for Type enumJune McEnroe 2019-12-30Remove scoop -ABCJune McEnroe 2019-12-30Add limit option for litterbox's search query interfaceJune McEnroe='/litterbox/commit/litterbox.c?h=1.5&id=8a4a9999baa28b6ace84fc1a5be69f8c71f3f88e&follow=1'>Parse mode types from ISUPPORTJune McEnroe 2020-04-05Add unscoop matchers for ban/unban eventsJune McEnroe 2020-04-05Check unscoop regexps with make testJune McEnroe 2020-04-05Add unscoop -n flag for checking regexpsJune McEnroe 2020-04-05Add Ban and Unban event typesJune McEnroe 2020-04-02Update styleJune McEnroe 2020-03-31Update unscoop catgirl matchersJune McEnroe 2020-03-31Fix writing verbose to stderrJune McEnroe 2020-03-02Include <>/-/* around nicks in scoop coloring 1.1June McEnroe 2020-03-02Replace .mk files with configure scriptJune McEnroe 2020-02-28Implement the causal.agency/consumer capabilityJune McEnroe 2020-02-22Include <>/-/* around nicks in coloringJune McEnroe 2020-02-22Use (almost) the full range of IRC colors for nicksJune McEnroe