データ処理の仕事をしていると「30分後くらいに今やってる処理が終わるから、そしたら出力結果を確認して次の処理を流す」とか「今投げてるクエリが終わるのを待ちつつ次のクエリを書く」といった時間差タスクがけっこう発生する。
別のタスクに手を出してしまうと、ついついそちらに熱中して、前に実行していたタスクのことを忘れてしまうことも多い。
そんな時は、libnotifyを使って指定時間に「そろそろ○○の作業終わったんじゃね?」といったnotifyを表示すれば、前のタスクを忘れずに済む。
とりあえずインストール。
$ sudo apt-get install libnotify-bin
notify-sendというコマンドで実行できるらしい。ヘルプは下記のような感じ。
$ notify-send --help Usage: notify-send [OPTION...] <SUMMARY> [BODY] - create a notification Help Options: -?, --help Show help options Application Options: -u, --urgency=LEVEL Specifies the urgency level (low, normal, critical). -t, --expire-time=TIME Specifies the timeout in milliseconds at which to expire the notification. -a, --app-name=APP_NAME Specifies the app name for the icon -i, --icon=ICON[,ICON...] Specifies an icon filename or stock icon to display. -c, --category=TYPE[,TYPE...] Specifies the notification category. -h, --hint=TYPE:NAME:VALUE Specifies basic extra data to pass. Valid types are int, double, string and byte. -v, --version Version of the package.
atと組み合わせれば、好きな時間にnotifyが出せる。
at 15:00 at> notify-send おやつの時間だぞ at> Ctrl+D
こういう書き方もできるらしい。
echo notify-send 本日は定時退社日です(絶賛形骸化中) | at 18:00
面倒なので自分は下記のような適当なシェルをhomeのbinに置いて、「notify 10:00 メッセージ」みたく書いている。
#!/bin/sh if [ $# -ne 2 ]; then echo "Usage : notify mm:dd message" exit 1 fi echo notify-send -t 600000 $2 | at $1 > /dev/null 2>&1
席を立ってて見逃したりするといけないので、-tで表示時間を10分で指定。