summaryrefslogtreecommitdiffstats
path: root/retiolum
diff options
context:
space:
mode:
authoreuer <root@euer.krebsco.de>2012-11-29 17:36:05 +0100
committereuer <root@euer.krebsco.de>2012-11-29 17:36:05 +0100
commit9df3e874598a68873df94ffa344e3c172824736a (patch)
treece091bc1eebf6f684f865405a815ff9c48878693 /retiolum
parent176cba685830af99bf2d4d8278ef01686c894dca (diff)
add github_listener
a listener which fires create-host-tar every time being hit by github webhook
Diffstat (limited to 'retiolum')
-rwxr-xr-xretiolum/bin/create-host-tar8
-rw-r--r--retiolum/scripts/github_listener/github_listener.conf3
-rwxr-xr-xretiolum/scripts/github_listener/listen6
3 files changed, 17 insertions, 0 deletions
diff --git a/retiolum/bin/create-host-tar b/retiolum/bin/create-host-tar
new file mode 100755
index 00000000..344109d1
--- /dev/null
+++ b/retiolum/bin/create-host-tar
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -xeuf
+WEBDIR=${WEBDIR:-/srv/http/pub/retiolum}
+HOSTFILE=$WEBDIR/hosts.tar
+cd $(dirname $(readlink -f $0))
+#rm $HOSTFILE
+tar cf $HOSTFILE -C ../hosts .
+chmod a+rx $HOSTFILE
diff --git a/retiolum/scripts/github_listener/github_listener.conf b/retiolum/scripts/github_listener/github_listener.conf
new file mode 100644
index 00000000..d1f2dae4
--- /dev/null
+++ b/retiolum/scripts/github_listener/github_listener.conf
@@ -0,0 +1,3 @@
+[program:github_listener]
+command=/krebs/retiolum/scripts/github_listener/listen 5432
+user=nobody
diff --git a/retiolum/scripts/github_listener/listen b/retiolum/scripts/github_listener/listen
new file mode 100755
index 00000000..c701d14b
--- /dev/null
+++ b/retiolum/scripts/github_listener/listen
@@ -0,0 +1,6 @@
+#!/bin/sh
+PORT=${1:-5432}
+# eloop pattern
+while sleep 1; do
+ nc -l -p $PORT -e /krebs/retiolum/bin/create-host-tar && logger "successfully built retiolum hosts tarball"
+done