LoginSignup
24
25

More than 5 years have passed since last update.

実行中のスクリプトが完了したらiPhoneにPush通知する

Last updated at Posted at 2013-04-19

処理がなかなか終わらないスクリプトを放置しといて、出先で完了したら通知を受け取れないかな〜と思ったらすごく簡単だったのでメモ。
参考:Prowl+zshで快適お昼寝タイム - a lonely miner

コマンド実行が完了したらiPhoneにインストールしたim.kayacへcurlで通知を投げてみます。

スクリプトが実行完了したらim.kayacで通知
$ sh long_proc.sh && curl -d "message=おわったよ" http://im.kayac.com/api/post/[user_name]

スクリプトの後に&&で通知処理を繋げるだけ。

さらにスクリプトの標準出力内容も通知してみる。もうちょいキレイに書く方法ないかな。。

実行結果を通知
$ result=$(sh long_proc.sh) && curl -d "message=$result" http://im.kayac.com/api/post/[user_name]
24
25
0

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
24
25