From: Tim Pope Date: Sun, 25 Jul 2004 00:31:49 +0000 (+0000) Subject: Added away-actions X-Git-Url: http://git.tpope.net/?p=tpope-extra.git;a=commitdiff_plain;h=f86f50df6ffba3c86da821709a3f4fdc0b621a6d Added away-actions --- diff --git a/bin/away-actions b/bin/away-actions new file mode 100755 index 0000000..5bcf9f9 --- /dev/null +++ b/bin/away-actions @@ -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