LoginSignup
2
0

More than 5 years have passed since last update.

Monacoin 価格通知

Last updated at Posted at 2017-10-08

Monacoin 価格通知

前提条件

brew install jq

インストール方法

# Download script file
curl -sSo /usr/local/bin/monacoin https://gist.githubusercontent.com/hanksudo/044b9b4b3d10289484190ff5568c4db7/raw/monacoin.sh
# Give executable permission
chmod +x /usr/local/bin/monacoin

または、自分で /usr/local/bin/monacoin を作成する

monacoin.sh
#/bin/sh

# $ monacoin
# 85.6

# Get price
MONA=`curl -s https://api.zaif.jp/api/1/last_price/mona_jpy | jq .last_price`

# macOS notifier
osascript -e "display notification \"$MONA\" with title \"Monacoin\""

# print
echo $MONA

# speak
say "monacoin $MONA"

使い方

$ monacoin
85.6

3時間ごとに実行する - launchagents

~/Library/LaunchAgents/monacoin.price.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>monacoin.price</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/monacoin</string>
    </array>
    <key>StartInterval</key>
    <integer>60 * 60 * 3</integer>
    <key>RunAtLoad</key>
    <true/>
    <key>StandardOutPath</key>
    <string>/tmp/monacoin.out</string>
    <key>StandardErrorPath</key>
    <string>/tmp/monacoin.err</string>
</dict>
</plist>

起動

launchctl setenv PATH /usr/local/bin:$PATH
launchctl load ~/Library/LaunchAgents/monacoin.price.plist
2
0
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
2
0