Skip to content

Instantly share code, notes, and snippets.

@starkfell
Created December 6, 2012 21:44
Show Gist options
  • Select an option

  • Save starkfell/4228757 to your computer and use it in GitHub Desktop.

Select an option

Save starkfell/4228757 to your computer and use it in GitHub Desktop.
Mysqldump backup script for OpCfg.
#!/bin/bash
#
# OpCfg_MySQL_Backup Script
#
# Author: Ryan Irujo
# Inception: 12.06.2012
# Last Modified: 12.06.2012
#
# Description: Mysqldump backup script for OpCfg.
#
#
# Changes:
#
#
#
MySQLUSER="root"
MySQLPASS=""
MySQLDB="opcfg"
MySQLHOST=`hostname`
DATE=`date +%m.%d.%y-%H%MEST`
BACKUP_PATH="/usr/local/icinga/share/opcfg/sqldata/"
if [ "$MySQLPASS" = "" ];then
echo "MySQL Password for OpCfg must be provided"
exit 2;
fi
`mysqldump -u$MySQLUSER -f -p$MySQLPASS $MySQLDB > OpCfg_Backup_$MySQLHOST\_$DATE.sql`
`mv OpCfg_Backup_$MySQLHOST\_$DATE.sql $BACKUP_PATH/OpCfg_Backup_$MySQLHOST\_$DATE.sql`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment