Skip to content

Commit

Permalink
[FEATURE] Ondemand backups;
Browse files Browse the repository at this point in the history
  • Loading branch information
Clark Burns committed Dec 4, 2014
1 parent 1030958 commit 31191af
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions simplebackup_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,24 @@ dateDrop=$(date +%m_%d_%Y -d "1 week ago")
backupFile="${scriptDir}/${backupFileName}_${dateToday}.sql"
dropFile="${scriptDir}/${backupFileName}_${dateDrop}.sql"

if [ $# -gt 0 ]
then
if [[ ${1} == 'ondemand' ]]
then
echo "Creating ondemand .sql dump of: ${dbName}"
onDemandBackupFile="${scriptDir}/${backupFileName}_ONDEMAND_${dateToday}.sql"
echo "Filename: ${onDemandBackupFile}"
mysqldump -h${dbHost} -u${dbUser} -p${dbPass} ${dbName} > ${onDemandBackupFile}
echo "Tada. All done."
exit 0
else
echo "Gibberish."
echo "Pass 'ondemand' as argument for one off .sql dump."
exit 1
fi
fi


echo "[STARTING BACKUP]" >> ${logFile}
echo "Backup file: ${backupFile}" >> ${logFile}
echo "Drop file: ${dropFile}" >> ${logFile}
Expand Down

0 comments on commit 31191af

Please sign in to comment.