Last active
June 27, 2021 21:49
-
-
Save crazyboycjr/dc635ab5117d8ebc571f06e015022c6d to your computer and use it in GitHub Desktop.
Usage: cmd-notify <your_command>
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/bash | |
WORKDIR=$(dirname `realpath $0`) | |
CMD=$* | |
env ${CMD} | |
status=$? | |
if [ $status -eq 0 ]; then | |
STATUS_PARAM="--success" | |
TITLE="Command finished" | |
else | |
STATUS_PARAM="--error" | |
TITLE="Command failed with error code: $status" | |
fi | |
${WORKDIR}/telegram-notify \ | |
--html \ | |
--config ${WORKDIR}/telegram-notify.conf \ | |
--text "${CMD}" \ | |
${STATUS_PARAM} \ | |
--title "${TITLE}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment