Skip to content

Instantly share code, notes, and snippets.

@ryowa1993
Last active July 13, 2016 06:37
Show Gist options
  • Select an option

  • Save ryowa1993/5ef8d0d016bd17bc45f0afd981c58ff4 to your computer and use it in GitHub Desktop.

Select an option

Save ryowa1993/5ef8d0d016bd17bc45f0afd981c58ff4 to your computer and use it in GitHub Desktop.
###SlackAttendBotについて
* Slackから勤怠を報告する
* SlackからきたメッセージをGoogleCalendarとGoogleDriveのSpreadSheetに書き込む
* チームマネージャーへのSlackChannelへ転送
###SlackAttendBotの基本コマンド
* ```
日時:YYYY-MM-DD
カテゴリ:遅刻|欠勤|早退|直行|直帰|出張|有給のどれか
理由:必須
詳細:必須
```
* (help|ヘルプ)勤怠フォーマットのヘルプ
###Launchdのサービス管理について
* launchdはデーモン、アプリケーション、プロセス、スクリプトの起動・停止・管理を行う、
オープンソースのサービス管理フレームワークです。(https://ja.wikipedia.org/wiki/Launchd)
* このフレームワークを使用して、LitaのAttendBotは、Slackとの接続が切れて、終了したとしても自動起動するようにしてあります。
* launchdを使用する時に設定ファイルが必要になります。
* 今回はbot.attend.slack.plistという設定ファイルを/System/Library/LaunchDaemons/に作成しました。
* 注意/System/Library/LaunchDaemons/はバージョンによって場所が異なるので注意しましょう。
* この**.plistファイルによっていつサービスを起動するか、どういった時に再起動するかなどを決めます。
* 参考 http://furudate.hatenablog.com/entry/2014/11/09/155017
.plist設置ファイルを作成するした後
```
# bot.attend.slack.plistを登録
launchctl load /System/Library/LaunchDaemons/bot.attend.slack
# 起動開始
launchctl start /System/Library/LaunchDaemons/bot.attend.slack
```
これで、Lauchchdが設定通りに管理してくれます。
管理から外す時は以下のように行います。
```
# bot.attend.slack.plistの登録解除
launchctl unload /System/Library/LaunchDaemons/bot.attend.slack
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment