From: Rodrigo Campos Date: Thu, 18 Nov 2010 15:42:33 +0000 (-0300) Subject: Create necessary files for new hosts X-Git-Url: https://git.llucax.com/software/bacap.git/commitdiff_plain/5b3f492851eb2f1335f3d2654cce156aab7b45a8?hp=a96e8b71705c563e3d0b5066653df27d674a9f12 Create necessary files for new hosts When a new host is added to the backup, we need to create the top-level directory for its backup. Also, don't issue an error when the "current" symlink can't be removed (because it doesn't exist yet). Signed-off-by: Rodrigo Campos --- diff --git a/bacap b/bacap index 2257848..5b74c5e 100755 --- a/bacap +++ b/bacap @@ -103,6 +103,7 @@ do source "$host_path/bacaprc" 2>/dev/null host=`basename "$host_path"` host_backup_path="$BACKUP_PATH/$host" + mkdir -p $host_backup_path dst="$BACKUP_PATH/$host/$date" src=`cat "$host_path/paths"` [ "$host" != "$LOCALHOST" ] && @@ -134,7 +135,7 @@ do --link-dest="$current_dir" $src "$dst/" || ret=$(($ret+1)) plog "Moving current..." - $run rm $V "$current_link" || + $run rm -f $V "$current_link" || ret=$(($ret+1)) $run ln -s $V "$date" "$current_link" || ret=$(($ret+1))