projects
/
tpope-extra.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Major changes to away system
[tpope-extra.git]
/
bin
/
away-actions
diff --git
a/bin/away-actions
b/bin/away-actions
index c49a1dc936d8dfc225b1da9b9ac3002be9ae458c..2ae60efaadd6e5326b738e0fcbbd31d537857213 100755
(executable)
--- a/
bin/away-actions
+++ b/
bin/away-actions
@@
-1,48
+1,66
@@
-#!/bin/sh
+#!/bin/
ba
sh
# $Id$
# $Id$
-# -*- sh -*- vim:
ft=sh sw=4 sts=4
+# -*- sh -*- vim:
set ft=sh sw=4 sts=4:
-# Performs routine actions based on my away status. Designed to be
-# periodically called by cron on homer.
+# 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`"
away="`tpope away`"
activity="`tpope activity`"
-ping -c 1 marge >/dev/null 2>&1 && eval `ssh marge cat .away-smart`
case "$away" in
case "$away" in
- Sleeping|"Away from keyboard"|
"Adult Swim"
|"") is_away=0 ;;
+ Sleeping|"Away from keyboard"|
TV*
|"") is_away=0 ;;
*[Cc]lass*) is_away=1 ;;
esac
*[Cc]lass*) is_away=1 ;;
esac
-[ "$
old_
phone" = absent ] && is_away=1
+[ "$phone" = absent ] && is_away=1
if [ "$is_away" = 1 ]; then
if [ "$is_away" = 1 ]; then
- [ ! -f /tmp/.tpope_lights ] && touch /tmp/.tpope_lights && br -F -F
+ [ ! -f /tmp/.tpope_lights ] && touch /tmp/.tpope_lights && \
+ $ssh homer br -F -F
elif [ -f /tmp/.tpope_lights ]; then
elif [ -f /tmp/.tpope_lights ]; then
- br -n 5
+
$ssh homer
br -n 5
rm -f /tmp/.tpope_lights
rm -f /tmp/.tpope_lights
- br -n 5
+
$ssh homer
br -n 5
fi
if [ "$activity" ]; then
information="$activity"
elif [ "$away" ]; then
information="$away"
fi
if [ "$activity" ]; then
information="$activity"
elif [ "$away" ]; then
information="$away"
-elif [ "$old_alive" = "lisa" ]; then
- information="On laptop"
else
else
- information=
+ 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
fi
if [ -z "$information" ]; then
- echo > "$HOME/.caminfo"
- echo Here > "$HOME/.status"
+ echo > "$HOME/.caminfo.deskcam"
+ echo "- On desktop" > "$HOME/.caminfo.bedcam"
+ #echo "On desktop" > "$HOME/.status"
rm -f "$HOME/.plan"
else
rm -f "$HOME/.plan"
else
- echo "- $information" > "$HOME/.caminfo"
- echo "$information" > "$HOME/.status"
+ 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
echo "$information" > "$HOME/.plan"
fi
-ping -c 1 bart >/dev/null && scp -q "$HOME/.status" bart: 2>/dev/null
-ping -c 1 abe >/dev/null && scp -q "$HOME/.status" abe: 2>/dev/null
+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