Netmiko - backup-cron.sh.md

#!/bin/bash

python3 /x/backup-fortigate.py
python3 /x/backup-cisco.py

OUTPUT=`su -s /bin/bash -c 'cd /x/configs && git status 2>&1' x 2>&1`;

if [[ $OUTPUT != *"nothing to commit, working directory clean"* ]]; then
  OUTPUT2=`su -s /bin/bash -c 'cd /x/configs && git add . 2>&1 && git commit -m "nemiko Bash Auto Git Push" 2>&1 && git push 2>&1' x 2>&1`;
  eval $(echo $OUTPUT2 | mail -s "netmiko Bash Auto Git Push" [email protected]);
  curl -H "Content-Type: application/json" -d "{\"title\": \"netmiko Bash Auto Git Push\", \"text\": \"*****        *****\n\n $OUTPUT2 \", \"themeColor\": \"EA4300\", \"type\": \"\" }" https://x;
else
  exit;
fi