Changeset 2259
- Timestamp:
- 07/10/08 23:18:42 (2 months ago)
- Files:
-
- alternc/trunk/debian/config (modified) (2 diffs)
- alternc/trunk/debian/postinst (modified) (2 diffs)
- alternc/trunk/src/sqlbackup.sh (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
alternc/trunk/debian/config
r2158 r2259 34 34 NS2_HOSTNAME="$FQDN" 35 35 HOSTING="AlternC" 36 SQLBACKUP_TYPE="rotate" 37 SQLBACKUP_OVERWRITE="no" 36 38 37 39 if [ -r /etc/alternc/local.sh ]; then … … 135 137 fi 136 138 139 db_get alternc/sql/backup_type 140 if [ -z "$RET" ] 141 then 142 db_set alternc/sql/backup_type "$SQLBACKUP_TYPE" 143 fi 144 145 db_get alternc/sql/backup_overwrite 146 if [ -z "$RET" ] 147 then 148 db_set alternc/sql/backup_overwrite "$SQLBACKUP_OVERWRITE" 149 fi 150 137 151 db_get alternc/alternc_location 138 152 if [ -z "$RET" ] alternc/trunk/debian/postinst
r2117 r2259 94 94 # Networks that SMTP should relay, separated with spaces 95 95 SMTP_RELAY_NETWORKS="" 96 97 # the type of backup created by the sql backup script 98 # valid options are "rotate" (newsyslog-style) or "date" (suffix is the date) 99 SQLBACKUP_TYPE="" 100 101 # overwrite existing files when backing up 102 SQLBACKUP_OVERWRITE="" 96 103 EOF 97 104 … … 118 125 update_var alternc/default_mx DEFAULT_MX 119 126 update_var alternc/mysql/client MYSQL_CLIENT 127 update_var alternc/sql/backup_type SQLBACKUP_TYPE 128 update_var alternc/sql/backup_overwrite SQLBACKUP_OVERWRITE 120 129 update_var alternc/alternc_location ALTERNC_LOC 121 130 update_var alternc/mynetwork SMTP_RELAY_NETWORKS alternc/trunk/src/sqlbackup.sh
r2258 r2259 137 137 fi 138 138 139 # if $ TYPE_NAME_BACKUPis set to "rotate" classical rotation files methode will be used139 # if $SQLBACKUP_TYPE is set to "rotate" classical rotation files methode will be used 140 140 # use incrementale number in the name of files where the highest number indicate 141 141 # the oldest files … … 146 146 # 147 147 # ------------------------------------------------------------------ # 148 # the variable TYPE_NAME_BACKUPmust be set in /etc/alternc/local.sh #148 # the variable SQLBACKUP_TYPE must be set in /etc/alternc/local.sh # 149 149 # ------------------------------------------------------------------ # 150 if [ $ TYPE_NAME_BACKUP== "rotate" ]; then150 if [ $SQLBACKUP_TYPE == "rotate" ]; then 151 151 152 152 i="$count" … … 200 200 fi 201 201 202 # if the backup exite and ALLOW_OVERWRITE_BACKUPis set to NO, cancel backup203 if [ -f "${target_dir}/${name_backup_file}.sql${ext}" ] && [ "$ ALLOW_OVERWRITE_BACKUP" == "no" ] ; then202 # if the backup exite and SQLBACKUP_OVERWRITE is set to NO, cancel backup 203 if [ -f "${target_dir}/${name_backup_file}.sql${ext}" ] && [ "$SQLBACKUP_OVERWRITE" == "no" ] ; then 204 204 205 205 info "sqlbackup.sh: ${target_dir}/${name_backup_file}.sql${ext}: already exist" 206 info " => no backup done as specify in allow-overwrite = $ ALLOW_OVERWRITE_BACKUP"206 info " => no backup done as specify in allow-overwrite = $SQLBACKUP_OVERWRITE" 207 207 DO_BACKUP="NO" 208 208 209 # if the backup exite and ALLOW_OVERWRITE_BACKUPis set to RENAME, add210 elif [ -f "${target_dir}/${name_backup_file}.sql${ext}" ] && [ "$ ALLOW_OVERWRITE_BACKUP" == "rename" ] ; then209 # if the backup exite and SQLBACKUP_OVERWRITE is set to RENAME, add 210 elif [ -f "${target_dir}/${name_backup_file}.sql${ext}" ] && [ "$SQLBACKUP_OVERWRITE" == "rename" ] ; then 211 211 212 212 info "sqlbackup.sh: ${target_dir}/${name_backup_file}.sql${ext}: already exist" 213 info " => renaming the new file as specify in allow-overwrite = $ ALLOW_OVERWRITE_BACKUP"213 info " => renaming the new file as specify in allow-overwrite = $SQLBACKUP_OVERWRITE" 214 214 hours=`date +"%H%M"` 215 215 name_backup_file="${name_backup_file}.${hours}" 216 216 217 # if the backup exite and ALLOW_OVERWRITE_BACKUPis set OVERWRITE, add218 elif [ -f "${target_dir}/${name_backup_file}.sql${ext}" ] && [ "$ ALLOW_OVERWRITE_BACKUP" == "overwrite" ] ; then217 # if the backup exite and SQLBACKUP_OVERWRITE is set OVERWRITE, add 218 elif [ -f "${target_dir}/${name_backup_file}.sql${ext}" ] && [ "$SQLBACKUP_OVERWRITE" == "overwrite" ] ; then 219 219 220 220 info "sqlbackup.sh: ${target_dir}/${name_backup_file}.sql${ext}: already exist" 221 info " => overwrite file as specify in allow-overwrite = $ ALLOW_OVERWRITE_BACKUP"221 info " => overwrite file as specify in allow-overwrite = $SQLBACKUP_OVERWRITE" 222 222 223 223 fi … … 292 292 -d|--debug) DEBUG="ON" ;; 293 293 -t|--type) shift; TYPE="$1";; 294 -n|--name-methode) shift; TYPE_NAME_BACKUP="$1";;295 -a|--allow-ovewrite) shift; ALLOW_OVERWRITE_BACKUP="$1" ;;294 -n|--name-methode) shift; SQLBACKUP_TYPE="$1";; 295 -a|--allow-ovewrite) shift; SQLBACKUP_OVERWRITE="$1" ;; 296 296 *) 297 297 error "invalide option -- $1" … … 306 306 307 307 debug "TYPE = $TYPE" 308 debug " TYPE_NAME_BACKUP = $TYPE_NAME_BACKUP"309 debug " ALLOW_OVERWRITE_BACKUP = $ALLOW_OVERWRITE_BACKUP"308 debug "SQLBACKUP_TYPE = $SQLBACKUP_TYPE" 309 debug "SQLBACKUP_OVERWRITE = $SQLBACKUP_OVERWRITE" 310 310 311 311 … … 329 329 fi 330 330 331 if ! ( [ -z "$ TYPE_NAME_BACKUP" ] ||332 [ "$ TYPE_NAME_BACKUP" == "date" ] ||333 [ "$ TYPE_NAME_BACKUP" == "rotate" ] ) ; then334 error "invalide argument: name-methode -- $ TYPE_NAME_BACKUP"331 if ! ( [ -z "$SQLBACKUP_TYPE" ] || 332 [ "$SQLBACKUP_TYPE" == "date" ] || 333 [ "$SQLBACKUP_TYPE" == "rotate" ] ) ; then 334 error "invalide argument: name-methode -- $SQLBACKUP_TYPE" 335 335 error "Try \`sqlbackup.sh --help' for more information." 336 336 exit 337 337 fi 338 338 339 if ! ( [ -z "$ ALLOW_OVERWRITE_BACKUP" ] ||340 [ "$ ALLOW_OVERWRITE_BACKUP" == "no" ] ||341 [ "$ ALLOW_OVERWRITE_BACKUP" == "rename" ] ||342 [ "$ ALLOW_OVERWRITE_BACKUP" == "overwrite" ] ); then343 error "invalide argument: allow-ovewrite -- $ ALLOW_OVERWRITE_BACKUP"339 if ! ( [ -z "$SQLBACKUP_OVERWRITE" ] || 340 [ "$SQLBACKUP_OVERWRITE" == "no" ] || 341 [ "$SQLBACKUP_OVERWRITE" == "rename" ] || 342 [ "$SQLBACKUP_OVERWRITE" == "overwrite" ] ); then 343 error "invalide argument: allow-ovewrite -- $SQLBACKUP_OVERWRITE" 344 344 error "Try \`sqlbackup.sh --help' for more information." 345 345 exit
