summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-10-25 16:22:43 +0100
committerYorhel <git@yorhel.nl>2009-11-02 22:16:23 +0100
commit9d75f5b0e22c1560a048f92c30cd6e572728d6b8 (patch)
treea0ae4b92702fa3a05d7a9f33cd821352543e55f7 /Makefile
parent77151c26876f1c9f6619df5c588499740407f1a8 (diff)
Makefile: Added rules for controlling Multi
This will come in handy when writing update rules.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile32
1 files changed, 31 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 351a09bf..df1d05aa 100644
--- a/Makefile
+++ b/Makefile
@@ -22,13 +22,17 @@
# chmod-tladmin
# The TransAdmin plugin also needs write access to some files
#
+# multi-start, multi-stop, multi-restart:
+# Start/stop/restart the Multi daemon. Provided for convenience, a proper initscript
+# probably makes more sense.
+#
#
# NOTE: This Makefile has only been tested using a recent version of GNU make
# in a relatively up-to-date Arch Linux environment, and may not work in other
# environments. Patches to improve the portability are always welcome.
-.PHONY: all staticdirs js skins robots chmod chmod-tladmin
+.PHONY: all staticdirs js skins robots chmod chmod-tladmin multi-start multi-stop multi-restart
all: staticdirs js skins robots
@@ -70,3 +74,29 @@ chmod: all
chmod-tladmin:
chmod a-x+rwX data/lang.txt data/docs data/docs/*\.*
+
+# may wait indefinitely, ^C and kill -9 in that case
+define multi-stop
+ if [ -s data/multi.pid ]; then\
+ kill `cat data/multi.pid`;\
+ while [ -s data/multi.pid ]; do\
+ if kill -0 `cat data/multi.pid`; then sleep 1;\
+ else rm -f data/multi.pid; fi\
+ done;\
+ fi
+endef
+
+define multi-start
+ util/multi.pl
+endef
+
+multi-stop:
+ $(multi-stop)
+
+multi-start:
+ $(multi-start)
+
+multi-restart:
+ $(multi-stop)
+ $(multi-start)
+