Skip to content

Instantly share code, notes, and snippets.

@jkanclerz
Created September 22, 2015 11:05
Show Gist options
  • Select an option

  • Save jkanclerz/01c761f262c804e43264 to your computer and use it in GitHub Desktop.

Select an option

Save jkanclerz/01c761f262c804e43264 to your computer and use it in GitHub Desktop.
Bash db connection monitoe
#!/bin/bash
user='user'
pass='pass'
host='host'
cmd="mysql -u $user -p$pass -h $host -e 'SHOW GLOBAL STATUS;'"
remoteCall='uptime'
if ! /bin/bash -c "$cmd";
then
ssh $host bash -c "$remoteCall"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment