Skip to content

Instantly share code, notes, and snippets.

@acro5piano
Last active September 11, 2016 11:35
Show Gist options
  • Save acro5piano/11f067d6002572581c5bbc82ca51de78 to your computer and use it in GitHub Desktop.
Save acro5piano/11f067d6002572581c5bbc82ca51de78 to your computer and use it in GitHub Desktop.
Bashにアラーム機能を搭載する(改) ref: http://qiita.com/acro5piano/items/12c829da344464134f37
alarm(){
echo "tmux detach-client; sleep 2; cowsay_to_single_pts $1" | at $2
}
#!/bin/bash
for t in `w -s | grep -v tty | grep ':0' | grep $SHELL | awk '{print $2}' | sed s:^:/dev/:`; do
echo $1 | cowsay > $t
done
# アラームをセット
alarm 'The meeting with my boss will start in 10 minutes' 9:50
# => job 22 at Thu Jun 1 9:50:00 2016
# アラーム一覧
atq
# => 22 Thu Jun 1 9:50:00 2016 a k-gosho
# JobIDを指定してアラームを削除
at -d 22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment