Skip to content

Instantly share code, notes, and snippets.

@crazyboycjr
Last active June 27, 2021 21:49
Show Gist options
  • Save crazyboycjr/dc635ab5117d8ebc571f06e015022c6d to your computer and use it in GitHub Desktop.
Save crazyboycjr/dc635ab5117d8ebc571f06e015022c6d to your computer and use it in GitHub Desktop.
Usage: cmd-notify <your_command>
#!/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