[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stdout in script



Hi all,

I try Tarsnap for some days now and it work perfectly.
He do what I tell it to do with the same simplicity of tar.

Actually, I've prepare a cron script to backup my system.
Echo to backup log (send to me by mail after backup) work great except for info about tarsnap stats.

Here a small extract of my script:

...
#Start Backup Data
echo "$(date +%H:%M) *1 Start Data Backup" >> ${backupdir}/backup.log
...
#Backup
${tarsnap} -c -f `hostname -s`-Data-${backupday} \
        --print-stats \
        ${mysqldir} \
        /usr/local/www \ >> ${backupdir}/backup.log
...
#Finish
if [ $?==0 ];then
  echo "$(${date} +%H:%M) *2 Backup Finnish"  >> ${backupdir}/backup.log
  mail -s "TarSnap Backup Success" ${adminmail} < ${backupdir}/backup.log
else
  echo "$(${date} +%H:%M) *2 Backup Failed" >> ${backupdir}/backup.log
  mail -s "TarSnap Backup Failed" ${adminmail} < ${backupdir}/backup.log
  exit
fi

But this is what I have in my mailbox

07:14 *1 Start Data Backup
07:18 *2 Backup Finnish

I don't know why *only* Tarsnap Stdout is not send to backup.log file
If I exec my script in shell, I saw stats normally -_-

Thanks

--
Antoine Michard