Changeset 2437

Show
Ignore:
Timestamp:
11/10/08 00:15:19 (3 weeks ago)
Author:
anarcat
Message:

be more resilient to errors

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • alternc/trunk/src/sqlbackup.sh

    r2423 r2437  
    159159              if [ -e "${target_dir}/${db}.sql.${next_i}${ext}" ]; then 
    160160                mv -f "${target_dir}/${db}.sql.${next_i}${ext}" \ 
    161                       "${target_dir}/${db}.sql.${i}${ext}" 2>/dev/null 
     161                      "${target_dir}/${db}.sql.${i}${ext}" 2>/dev/null || true 
    162162              fi 
    163163              i=$next_i # loop should end here 
     
    167167            if [ -e "${target_dir}/${db}.sql${ext}" ]; then 
    168168              mv -f "${target_dir}/${db}.sql${ext}" \ 
    169                     "${target_dir}/${db}.sql.${i}${ext}" 2>/dev/null 
     169                    "${target_dir}/${db}.sql.${i}${ext}" 2>/dev/null || true 
    170170            fi 
    171171 
     
    193193            #  
    194194            debug "find ${target_dir} -name \"${db}.*sql${ext}\" -maxdepth 1 -mtime +$last2del -exec rm -f {} \; -ls" 
    195             find ${target_dir} -name "${db}.*sql${ext}" -maxdepth 1 -mtime +${last2del} -exec rm -f {} \; -ls 
     195            find ${target_dir} -name "${db}.*sql${ext}" -maxdepth 1 -mtime +${last2del} -exec rm -f {} \; -ls || true 
    196196             
    197197            # set the name of the backup file with the date of the day 
     
    247247           if [ "$compressed" -eq 1 ] ; then 
    248248               debug "$command > ${target_dir}/${name_backup_file}.sql${ext}" 
    249                $command | gzip -c > "${target_dir}/${name_backup_file}.sql${ext}" 
     249               $command | gzip -c > "${target_dir}/${name_backup_file}.sql${ext}" || echo "backup failed for ${name_backup_file}" 
    250250           else 
    251251               debug "$command > ${target_dir}/${name_backup_file}.sql${ext}" 
    252                $command > "${target_dir}/${name_backup_file}.sql${ext}" 
     252               $command > "${target_dir}/${name_backup_file}.sql${ext}" || echo "backup failed for ${name_backup_file}" 
    253253           fi 
    254254        fi