summaryrefslogtreecommitdiff
path: root/zshfunc
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2009-06-28 00:06:33 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2009-06-28 00:06:33 +0000
commitab8c169a9a13cafd39570531c86f0cd1f8ee6bc5 (patch)
tree0147dd6bcc3b036975c0f4d3bd5b99366e6afd8d /zshfunc
parent39b03192816e15a611115e9a2c81de974795da06 (diff)
Add buildd-{stop,start}
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@402 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
Diffstat (limited to 'zshfunc')
-rw-r--r--zshfunc/buildd-start11
-rw-r--r--zshfunc/buildd-stop26
2 files changed, 37 insertions, 0 deletions
diff --git a/zshfunc/buildd-start b/zshfunc/buildd-start
new file mode 100644
index 0000000..6d35916
--- /dev/null
+++ b/zshfunc/buildd-start
@@ -0,0 +1,11 @@
+buildd-start() {
+ local need_sudo
+
+ if [ -r ~buildd ] ; then
+ need_sudo=""
+ else
+ need_sudo="sudo"
+ fi
+
+ $need_sudo find ~buildd -maxdepth 1 -name NO-DAEMON-PLEASE -group adm -ls | grep NO-DAEMON-PLEASE && sudo rm -v ~buildd/NO-DAEMON-PLEASE
+}
diff --git a/zshfunc/buildd-stop b/zshfunc/buildd-stop
new file mode 100644
index 0000000..c4ced45
--- /dev/null
+++ b/zshfunc/buildd-stop
@@ -0,0 +1,26 @@
+buildd-stop() {
+ local need_sudo
+
+ if [ -r ~buildd ] && [ -r ~buildd/build ] ; then
+ need_sudo=""
+ else
+ need_sudo="sudo"
+ fi
+
+ if $need_sudo test -e ~buildd/NO-DAEMON-PLEASE; then
+ echo "no-daemon-please already exists:"
+ $need_sudo ls -l ~buildd/NO-DAEMON-PLEASE
+ if $need_sudo test -e ~buildd/build/buildd.pid ; then
+ echo "buildd still running?"
+ else
+ echo "pidfile of buildd doesn't exist. Good. Assuming it doesn't run."
+ fi
+ ps xauf | grep 'build[d]'
+ else
+ echo "Touching ~buildd/NO-DAEMON-PLEASE ~buildd/EXIT-DAEMON-PLEASE"
+ sudo -u buildd touch ~buildd/NO-DAEMON-PLEASE ~buildd/EXIT-DAEMON-PLEASE &&
+ sudo chgrp -v adm ~buildd/NO-DAEMON-PLEASE &&
+ echo "Sending HUP to buildd"
+ sudo -u buildd kill -HUP `sudo cat ~buildd/build/buildd.pid`
+ fi
+}