Table of Contents

Process exit notifion

Just started a boring long rsync and need to be ready when it's one? Want to do something else in the meanwhile?

Requirements

The alias

Feel free to dump this in your alias file instead of using the one below..

nma() { ECFNMA=$?; /opt/nma.sh $HOSTNAME "${1:-"$(fc -nl -1 | awk '{print $1;}')"}" "$(if [ $ECFNMA -eq 0 ]; then echo "Success.."; else echo "Failed.."; fi; echo "Exit code: $ECFNMA")" ${1:-0};}

Install

curl http://storage.locked.io/files/nma.sh -o /opt/nma.sh && nano /opt/nma.sh; chmod +x /opt/nma.sh
echo bm1hKCkgeyBFQ0ZOTUE9JD87IC9vcHQvbm1hLnNoICRIT1NUTkFNRSAiJHsxOi0iJChmYyAtbmwgLTEgfCBhd2sgJ3twcmludCAkMTt9JykifSIgIiQoaWYgWyAkRUNGTk1BIC1lcSAwIF07IHRoZW4gZWNobyAiU3VjY2Vzcy4uIjsgZWxzZSBlY2hvICJGYWlsZWQuLiI7IGZpOyBlY2hvICJFeGl0IGNvZGU6ICRFQ0ZOTUEiKSIgJHsxOi0wfTt9 | base64 --decode >> ~/.bashrc 
# Sorry for base64, I got tired of escaping characters.. Remember to add your APIKEY in nma.sh!

Example of use

<process>; nma [Event Name] [Priority]

bash -c 'exit 0'; nma 
bash -c 'exit 1'; nma
bash -c 'exit 1'; nma Kagemand 1 # 1 as priority
curl -s 'http://google.com' > /dev/null; nma # exit code 0
curl -s 'http://itsErrorTiem' > /dev/null; nma # exit code 6