重いバッチ処理とか回してるときに他の作業してて回してたの忘れがちなので音で知らせたい。
音を鳴らすパターンは以下がいろいろ載っててよい。
bash - コマンドが終了したら音を鳴らしたい - スタック・オーバーフロー
その中のを組み合わせて(個人的に)いい感じにしたのが以下
~/.zshrc
finish () {
if [ $? -eq 0 ]; then
afplay /System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/system/burn\ complete.aif
else
afplay /System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/system/Volume\ Mount.aif
fi
}
- exitステータスで音を切り替え
- Macにデフォで入ってるシステムサウンドのうち成功っぽいやつと失敗っぽいやつを指定
以下のようにしてコマンドのあとにfinishつけて使う。
$ ruby heavy_process.rb; finish