MySQL백업

PXE Boot에 NFS돌리느라.. 쪼맨한 서버 용량도 모자라 백업안하고 있었는데
이런일이 일어나다니.. ㅠ.ㅠ

이젠 내 서버도 30분마다 백업이닷!

#!/bin/sh
backupDir=”/opt/backupMysql”;


dateTime=$(/bin/date +%Y-%m-%d_%H.%M.%S)


if [ ! -e $backupDir/$dateTime ]; then
    echo “Backup Directory NOT EXIST!! ($backupDir)”;
    /bin/mkdir $backupDir/$dateTime
    /bin/chmod 700 $backupDir/$dateTime
    echo “mkdir $backupDir/$dateTime”;
    echo “chmod 700 $backupDir/$dateTime”;
fi


/usr/bin/mysqlhotcopy zeroidle $backupDir/$dateTime/

dateEndTime=$(/bin/date +%Y-%m-%d_%H.%M.%S)


echo “$dateTime ~ $dateEndTime Done.”;


/usr/bin/find $backupDir -maxdepth 1 -type d -ctime +5 -ls -exec rm -rf {} ;

// Kernel 2.4는  -ctime말고 -mtime