#!/bin/bash # $Id$ # -*- sh -*- vim:set ft=sh sw=4 sts=4: # Checks several sources of information and updates my away status # appropriately. Designed to be periodically called by away-tpope. PATH="$HOME/bin:/bin:/usr/bin" away="`tpope away`" activity="`tpope activity`" case "$away" in Sleeping|"Away from keyboard"|TV*|"") is_away=0 ;; *[Cc]lass*) is_away=1 ;; esac [ "$phone" = absent ] && is_away=1 if [ "$is_away" = 1 ]; then [ ! -f /tmp/.tpope_lights ] && touch /tmp/.tpope_lights && \ $ssh homer br -F -F elif [ -f /tmp/.tpope_lights ]; then $ssh homer br -n 5 rm -f /tmp/.tpope_lights $ssh homer br -n 5 fi if [ "$activity" ]; then information="$activity" elif [ "$away" ]; then information="$away" else case "$alive" in lisa*|abe*) information="On laptop" ;; sarah*) information="In bed" ;; mona*|homer*) information="On desktop" ;; *) information="Away from keyboard?" ;; esac fi if [ -z "$information" ]; then echo > "$HOME/.caminfo.deskcam" echo "- On desktop" > "$HOME/.caminfo.bedcam" #echo "On desktop" > "$HOME/.status" rm -f "$HOME/.plan" else echo "- $information" > "$HOME/.caminfo.deskcam" if [ "$information" = "In bed" ]; then echo "" > "$HOME/.caminfo.bedcam" else echo "- $information" > "$HOME/.caminfo.bedcam" fi #echo "$information" > "$HOME/.status" echo "$information" > "$HOME/.plan" fi for host in bart homer sarah clancy; do ping -c 1 $host >/dev/null && scp -q "$HOME/.status" $host: 2>/dev/null done ping -c 1 homer >/dev/null && scp -q "$HOME/.caminfo.deskcam" homer:.caminfo 2>/dev/null ping -c 1 sarah >/dev/null && scp -q "$HOME/.caminfo.bedcam" sarah:.caminfo 2>/dev/null rm -f .caminfo.bedcam exit 0