This file contains 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/bash | |
# Slack notification script for Munin | |
# Mark Matienzo (@anarchivist) | |
# | |
# To use: | |
# 1) Create a new incoming webhook for Slack | |
# 2) Edit the configuration variables that start with "SLACK_" below | |
# 3) Add the following to your munin configuration: | |
# |
This file contains 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/bash -eu | |
LOG_FILE=$1 | |
SB="stdbuf -i0 -oL" | |
shift | |
tput sc | |
$@ 2>&1 | $SB tee $LOG_FILE | $SB cut -c-$(tput cols) | $SB sed -u 's/\(.\)/\\\1/g' | $SB xargs -0 -d'\n' -iyosi -n1 bash -c 'tput rc;tput el; printf "\r%s" yosi' | |
EXIT_CODE=${PIPESTATUS[0]} | |
tput rc;tput el;printf "\r" # Delete the last printed line | |
exit $EXIT_CODE |