I'm trying to put together bash script to backup whole system. This is my bash try so obviously I messed up something!
#!/bin/bash
mybackupname="backup-fullsys-$(date +%Y-%m-%d).tar.gz"
logfile="backup-system.log"
echo Backup Started `date` >> ${logfile}
tar -cpzvf ${mybackupname} --exclude=/${mybackupname} --exclude=/proc --exclude=/lost+found --exclude=/sys --exclude=/mnt --exclude=/media --exclude=/dev / >> ${logfile}
ls -gh ${mybackupname} >> ${logfile}
mv -v ${mybackupname} backups/filesystem/ >> ${logfile}
echo Backup Completed `date` >> ${logfile}
sendEmail -v -f @gmail.com -s smtp.gmail.com:587 -xu user -xp pass -t [email protected] -o tls=yes -u Tittle Full Backup -m Server Reports -a ${logfile}
exit
It was run using cron.
And on my email I received this:
-rw-r--r-- 1 root 965M Jul 13 16:11 backup-fullsys-2012-07-13.tar.gz
`backup-fullsys-2012-07-13.tar.gz' -> `backups/filesystem/'
Backup Completed Fri Jul 13 16:11:14 GET 2012
Now funny thing is that I thought bash script would run from my home directory. So path I included in script is backups/filesystem/. This folder does exist in /home/me/backups/filesystem/ and bash script is located in /home/me/bash.bash
I cannot find neither tar or log file! I tried to cd into folder, nothing.
I tried locate/find.
When I do df -h though I can see that something is taking space. My original partition was 2gb now it is 4gb so file is there somewhere.