crossroads

Git mirror of https://crossroads.e-tunity.com/
git clone git://git.finwo.net/app/crossroads
Log | Files | Refs | LICENSE

commit 84e1b9c6632921818c00f6c033014ec1cead8881
parent cd2e105ef46b750f960bb0a752453d77e580edf3
Author: finwo <finwo@pm.me>
Date:   Sat,  3 Jan 2026 19:39:07 +0100

2.78

Diffstat:
MChangeLog | 3+++
MMakefile | 2+-
Mxrctl/xrctl | 52+++++++++++++++++++++++++++++++++++-----------------
3 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,6 @@ +2.78 [KK 2012-04-18] +- xrctl fixes, thanks Carlos H. for reporting! + 2.77 [KK 2012-02-16] - gc++ 4.6 portability issues diff --git a/Makefile b/Makefile @@ -1,7 +1,7 @@ # Top-level Makefile for XR # ------------------------- -VER ?= 2.77 +VER ?= 2.78 PREFIX ?= $(DESTDIR)/usr BINDIR ?= $(PREFIX)/sbin MANDIR ?= $(PREFIX)/share/man diff --git a/xrctl/xrctl b/xrctl/xrctl @@ -149,11 +149,15 @@ sub cmd_list { } sub cmd_start { + my @to_start; for my $s (@_) { - die ("Cannot start service $s, already running\n") - if (is_running($s)); + if (is_running($s)) { + warn("Cannot start service $s, already running\n"); + } else { + push(@to_start, $s); + } } - for my $s (@_) { + for my $s (@to_start) { print ("Service $s: "); start_service($s); print ("started\n"); @@ -163,10 +167,13 @@ sub cmd_start { sub cmd_stop { my @pids; for my $s (@_) { - my @p = is_running($s) - or die ("Cannot stop service $s, not running\n"); - print ("Service $s: running at @p\n"); - push (@pids, @p); + my @p = is_running($s); + if ($#p == -1) { + warn("Cannot stop service $s, not running\n"); + } else { + print ("Service $s: running at @p\n"); + push (@pids, @p); + } } for my $p (@pids) { msg ("About to stop PID: '$p'\n"); @@ -178,10 +185,13 @@ sub cmd_stop { sub cmd_kill { my @pids; for my $s (@_) { - my @p = is_running($s) - or die ("Cannot stop service $s, not running\n"); - print ("Service $s: running at @p\n"); - push (@pids, @p); + my @p = is_running($s); + if ($#p == -1) { + warn("Cannot kill service $s, not running\n"); + } else { + print ("Service $s: running at @p\n"); + push (@pids, @p); + } } for my $p (@pids) { msg ("About to kill PID: '$p'\n"); @@ -205,9 +215,12 @@ sub cmd_force { sub cmd_stopstart { my @pids; for my $s (@_) { - my @p = is_running($s) - or die ("Cannot stopstart service $s, not running\n"); - push (@pids, @p); + my @p = is_running($s); + if ($#p == -1) { + warn("Cannot stop service $s, not running\n"); + } else { + push (@pids, @p); + } } print ("Service(s) @_: "); kill (15, @pids) if ($#pids > -1); @@ -222,9 +235,12 @@ sub cmd_stopstart { sub cmd_killstart { my @pids; for my $s (@_) { - my @p = is_running($s) - or die ("Cannot killstart service $s, not running\n"); - push (@pids, @p); + my @p = is_running($s); + if ($#p == -1) { + warn("Cannot killstart service $s, not running\n"); + } else { + push (@pids, @p); + } } print ("Service(s) @_: "); kill (9, @pids) if ($#pids > -1); @@ -648,6 +664,8 @@ sub xr_cmdarr { push (@cmd, '--backend', $ad); } + # TODO: <piddir> stuff, and the pid, resulting in something like: + # push(@cmd, '--pidfile', "/var/run/xr-$service.pid"); # All done my @ret;