[yadt] push by krux...@gmail.com - adding yadt-status-host on 2013-06-24 14:27 GMT

1 view
Skip to first unread message

ya...@googlecode.com

unread,
Jun 24, 2013, 10:28:09 AM6/24/13
to yadt-...@googlegroups.com
Revision: 346b8fc85930
Branch: default
Author: kru...@gmail.com
Date: Mon Jun 24 07:25:30 2013
Log: adding yadt-status-host
http://code.google.com/p/yadt/source/detail?r=346b8fc85930

Modified:
/yadt-client/src/usr/bin/yadt-status-host

=======================================
--- /yadt-client/src/usr/bin/yadt-status-host Mon Jun 24 07:17:53 2013
+++ /yadt-client/src/usr/bin/yadt-status-host Mon Jun 24 07:25:30 2013
@@ -1,1 +1,26 @@
-yadt-host-status
+#!/bin/bash
+set -u -e -E -o pipefail -C
+
+DEFAULT_FILE=/etc/default/yadt
+. $DEFAULT_FILE
+
+MAX_ARTEFACTS_CACHE_AGE=60
+
+EPOCH=$(date +%s)
+
+mkdir -p "$YADT_LOG_DIR/$(date +%Y-%m-%d)"
+
+
+# returning repository information, resulting in next_artefacts and
+# defining the host state
+ARTEFACTS_CACHE=/var/cache/yadt/yadt-status-artefacts.cached
+[[ ! -e $ARTEFACTS_CACHE ]] && /usr/bin/yadt-status-artefacts
+
+AC_MODIFICATION=$(stat --format %Y $ARTEFACTS_CACHE)
+AC_AGE=$(( $EPOCH - $AC_MODIFICATION ))
+
+if [[ $AC_AGE -gt $MAX_ARTEFACTS_CACHE_AGE ]]; then
+ /usr/bin/yadt-status-artefacts
+fi
+
+grep -q "state: uptodate" $ARTEFACTS_CACHE
Reply all
Reply to author
Forward
0 new messages