3 # -*- sh -*- vim:set ft=sh sw=4 sts=4:
5 # Checks several sources of information and updates my away status
6 # appropriately. Designed to be periodically called by away-tpope.
8 PATH="$HOME/bin:/bin:/usr/bin"
11 activity="`tpope activity`"
14 Sleeping|"Away from keyboard"|TV*|"") is_away=0 ;;
15 *[Cc]lass*) is_away=1 ;;
18 [ "$phone" = absent ] && is_away=1
20 if [ "$is_away" = 1 ]; then
21 [ ! -f /tmp/.tpope_lights ] && touch /tmp/.tpope_lights && \
23 elif [ -f /tmp/.tpope_lights ]; then
25 rm -f /tmp/.tpope_lights
29 if [ "$activity" ]; then
30 information="$activity"
31 elif [ "$away" ]; then
35 lisa*|abe*) information="On laptop" ;;
36 sarah*) information="In bed" ;;
37 mona*|homer*) information="On desktop" ;;
38 *) information="Away from keyboard?" ;;
42 if [ -z "$information" ]; then
43 echo > "$HOME/.caminfo.deskcam"
44 echo "- On desktop" > "$HOME/.caminfo.bedcam"
45 #echo "On desktop" > "$HOME/.status"
48 echo "- $information" > "$HOME/.caminfo.deskcam"
49 if [ "$information" = "In bed" ]; then
50 echo "" > "$HOME/.caminfo.bedcam"
52 echo "- $information" > "$HOME/.caminfo.bedcam"
54 #echo "$information" > "$HOME/.status"
55 echo "$information" > "$HOME/.plan"
58 for host in bart homer sarah clancy; do
59 ping -c 1 $host >/dev/null && scp -q "$HOME/.status" $host: 2>/dev/null
62 ping -c 1 homer >/dev/null && scp -q "$HOME/.caminfo.deskcam" homer:.caminfo 2>/dev/null
63 ping -c 1 sarah >/dev/null && scp -q "$HOME/.caminfo.bedcam" sarah:.caminfo 2>/dev/null