summary refs log tree commit diff
path: root/service.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-08-16 23:01:25 -0400
committerJune McEnroe <june@causal.agency>2020-08-16 23:01:25 -0400
commit6302579f2242830d2ab88930194d978707c174a9 (patch)
tree629fa90f37c4927927f616205c22b756c3600031 /service.c
parentOnly call setgroups as root (diff)
downloadcatsit-6302579f2242830d2ab88930194d978707c174a9.tar.gz
catsit-6302579f2242830d2ab88930194d978707c174a9.zip
Add drop command
Diffstat (limited to '')
-rw-r--r--service.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/service.c b/service.c
index 78890b8..9a3b157 100644
--- a/service.c
+++ b/service.c
@@ -119,6 +119,14 @@ err:
 	return -1;
 }
 
+void serviceDrop(size_t index) {
+	struct Service *service = &services.ptr[index];
+	if (service->state != Stop) return;
+	syslog(LOG_NOTICE, "%s[] dropped", service->name);
+	serviceFree(service);
+	services.ptr[index] = services.ptr[--services.len];
+}
+
 void serviceStatus(struct Service *service) {
 	if (service->state == Stop && service->intent == Stop) {
 		syslog(LOG_NOTICE, "%s[] is stopped", service->name);