Created
August 28, 2024 09:15
-
-
Save ihoro/024391c4408052ccd4570fd597a8d140 to your computer and use it in GitHub Desktop.
muninn -- run a command and report via Slack webhook when it's complete
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # | |
| # Usage examples: | |
| # $ make -j8 buildworld; muninn | |
| # $ muninn make -j8 buildworld # TODO: double quotes are not supported yet in the string after muninn | |
| # | |
| T_START=$(date "+%s") | |
| $* | |
| T_END=$(date "+%s") | |
| T_DIFF_MIN=$(( ($T_END-$T_START)/60 )) | |
| msg="$*" | |
| test -n "$msg" || msg="DONE." | |
| curl -s -X POST --data-urlencode "payload={\"text\": \"${T_DIFF_MIN}min $(hostname): $msg\"}" "$(cat ~/.slack.incomingwebhook)" | |
| echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment