Added away-actions
authorTim Pope <code@tpope.net>
Sun, 25 Jul 2004 00:31:49 +0000 (00:31 +0000)
committerTim Pope <code@tpope.net>
Sun, 25 Jul 2004 00:31:49 +0000 (00:31 +0000)
bin/away-actions [new file with mode: 0755]

diff --git a/bin/away-actions b/bin/away-actions
new file mode 100755 (executable)
index 0000000..5bcf9f9
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/sh
+# $Id$
+# -*- sh -*- vim: ft=sh sw=4 sts=4
+
+# Performs routine actions based on my away status.  Designed to be
+# periodically called by cron on homer.
+
+away="`tpope away`"
+activity="`tpope activity`"
+ping -c 1 marge >/dev/null 2>&1 && eval `ssh marge cat .away-smart`
+
+case "$away" in
+    Sleeping|"Away from keyboard"|"Adult Swim"|"") is_away=0 ;;
+    *[Cc]lass*) is_away=1 ;;
+esac
+
+[ "$old_phone" = absent ] && is_away=1
+
+if [ "$is_away" = 1 ]; then
+    [ ! -f /tmp/.tpope_lights ] && touch /tmp/.tpope_lights && br -F -F
+else
+    rm -f /tmp/.tpope_lights; br -n 5
+fi
+
+if [ "$activity" ]; then
+    information="$activity"
+elif [ "$away" ]; then
+    information="$away"
+elif [ "$old_alive" = "lisa" ]; then
+    information="On laptop"
+else
+    information=
+fi
+
+if [ -z "$information" ]; then
+    echo > "$HOME/.caminfo"
+    echo Here > "$HOME/.status"
+    rm -f "$HOME/.plan"
+else
+    echo " - $information" > "$HOME/.caminfo"
+    echo "$information" > "$HOME/.status"
+    echo "$information" > "$HOME/.plan"
+fi
+
+ping -c 1 bart >/dev/null && scp -q "$HOME/.status" bart: 2>/dev/null