15
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Bashにアラーム機能を搭載する

Last updated at Posted at 2016-06-01

※下記の記事で、改良版を紹介しています。
Bashにアラーム機能を搭載する(改)

作業に没頭していると予定を忘れやすいので、予定時刻になったらターミナル上にメッセージを割り込ませるアラームを作った。

# この関数を~/.bash_aliasesなどに書いておく
alarm(){
    echo "echo $1 | cowsay | wall" | at $2
}

利用方法はこんな感じ


# アラームをセット
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

なお、導入にはatcowsayコマンドが必要。

時間になるとこんな感じのメッセージがターミナルに表示される。ちなみにこれはVimで作業している状態。

image

さすがにこれで忘れることはない。

15
14
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?