Browse Source

* Change tar structure

Guzmán Castanedo Villalba 2 years ago
parent
commit
e6376744d3
1 changed files with 16 additions and 16 deletions
  1. 16 16
      backup-server

+ 16 - 16
backup-server

@@ -381,7 +381,7 @@ function makeTar {
 	#Copy webpages code (except backup and main/public)
 	if [ $noWeb = false ];then
 		printf "Adding:\t%s\n" $webDir
-		tar -rf $tempOutput -C $(dirname $webDir) --exclude=www/backup --exclude=www/main/public $(basename $webDir) > /dev/null 2>&1
+		tar -rf $tempOutput --exclude=var/www/backup --exclude=var/www/main/public $webDir > /dev/null 2>&1
 		if [ $? != 0 ]; then
 			printf "WARNING:\tError copying web pages (Continue).\n"
 		fi
@@ -420,7 +420,7 @@ function makeTar {
 	#Copy nginx configuration (sites-available)
 	if [ $noNginx = false ];then
 		printf "Adding:\t%s\n" $nginxDir
-		tar -rf $tempOutput -C $(dirname $nginxDir) $(basename $nginxDir) > /dev/null 2>&1
+		tar -rf $tempOutput $nginxDir > /dev/null 2>&1
 		if [ $? != 0 ];then
 			printf "WARNING:\tError copying nginx configuration (Continue)\n"
 		fi
@@ -429,7 +429,7 @@ function makeTar {
 	#Copy Email (this could be heavy in the future)
 	if [ $noMail = false ];then
 		printf "Adding:\t%s\n" $mailDir
-		tar -rf $tempOutput -C $(dirname $mailDir) $(basename $mailDir) > /dev/null 2>&1
+		tar -rf $tempOutput $mailDir > /dev/null 2>&1
 		if [ $? != 0 ];then
 			printf "WARNING:\tError copying mailboxes (Continue)\n"
 		fi
@@ -438,7 +438,7 @@ function makeTar {
 	#Copy Certificates (LetsEncrypt)
 	if [ $noLetsencrypt = false ];then
 		printf "Adding:\t%s\n" $letsencryptDir
-		tar -rf $tempOutput -C $(dirname $letsencryptDir) $(basename $letsencryptDir) > /dev/null 2>&1
+		tar -rf $tempOutput $letsencryptDir > /dev/null 2>&1
 		if [ $? != 0 ];then
 			printf "WARNING:\tError copying Let's Encrypt certificates (Continue)\n"
 		fi
@@ -447,7 +447,7 @@ function makeTar {
 	#Copy /home
 	if [ $noHome = false ];then
 		printf "Adding:\t%s\n" $homeDir
-		tar -rf $tempOutput -C $(dirname $homeDir) $(basename $homeDir) > /dev/null 2>&1
+		tar -rf $tempOutput $homeDir > /dev/null 2>&1
 		if [ $? != 0 ];then
 			printf "WARNING:\tError copying home dir (Continue)\n"
 		fi
@@ -456,7 +456,7 @@ function makeTar {
 	#Copy GOGS
 	if [ $noGogs = false ];then
 		printf "Adding:\t%s\n" $gogsDir
-		tar -rf $tempOutput -C $(dirname $gogsDir) $(basename $gogsDir) > /dev/null 2>&1
+		tar -rf $tempOutput $gogsDir > /dev/null 2>&1
 		if [ $? != 0 ];then
 			printf "WARNING:\tError copying GOGS Repository (Continue)\n"
 		fi
@@ -465,7 +465,7 @@ function makeTar {
 	#Copy Postfix
 	if [ $noPostfix = false ] && [ -d $postfixDir ];then
 		printf "Adding:\t%s\n" $postfixDir
-		tar -rf $tempOutput -C $(dirname $postfixDir) $(basename $postfixDir) > /dev/null 2>&1
+		tar -rf $tempOutput $postfixDir > /dev/null 2>&1
 		if [ $? != 0 ];then
 			printf "WARNING:\tError copying Postfix configuration (Continue)\n"
 		fi
@@ -474,7 +474,7 @@ function makeTar {
 	#Copy Dovecot
 	if [ $noDovecot = false ];then
 		printf "Adding:\t%s\n" $dovecotDir
-		tar -rf $tempOutput -C $(dirname $dovecotDir) $(basename $dovecotDir) > /dev/null 2>&1
+		tar -rf $tempOutput $dovecotDir > /dev/null 2>&1
 		if [ $? != 0 ];then
 			printf "WARNING:\tError copying Dovecot configuration (Continue)\n"
 		fi
@@ -484,7 +484,7 @@ function makeTar {
 	if [ $noOpenDKIM = false ];then
 		if [ -f $openDKIMConf ];then
 			printf "Adding:\t%s\n" $openDKIMConf
-			tar -rf $tempOutput -C $(dirname $openDKIMConf) $(basename $openDKIMConf) > /dev/null 2>&1
+			tar -rf $tempOutput $openDKIMConf > /dev/null 2>&1
 			if [ $? != 0 ];then
 				printf "WARNING:\tError copying OpenDKIM configuration (Continue)\n"
 			fi
@@ -493,7 +493,7 @@ function makeTar {
 		fi
 		if [ -f $openDKIMDefault ];then
 			printf "Adding:\t%s\n" $openDKIMDefault
-			tar -rf $tempOutput -C $(dirname $(dirname $openDKIMDefault)) $(basename $(dirname $openDKIMDefault))/$(basename $openDKIMDefault) > /dev/null 2>&1
+			tar -rf $tempOutput $openDKIMDefault > /dev/null 2>&1
 			if [ $? != 0 ];then
 				printf "WARNING:\tError copying OpenDKIM sockets configuration (Continue)\n"
 			fi
@@ -502,7 +502,7 @@ function makeTar {
 		fi
 		if [ -d $openDKIMKeys ];then
 			printf "Adding:\t%s\n" $openDKIMKeys
-			tar -rf $tempOutput -C $(dirname $openDKIMKeys) $(basename $openDKIMKeys) > /dev/null 2>&1
+			tar -rf $tempOutput $openDKIMKeys > /dev/null 2>&1
 			if [ $? != 0 ];then
 				printf "WARNING:\tError copying OpenDKIM keys (Continue)\n"
 			fi
@@ -514,7 +514,7 @@ function makeTar {
 	#Copy SPF
 	if [ $noSPF = false ];then
 		printf "Adding:\t%s\n" $spfDir
-		tar -rf $tempOutput -C $(dirname $spfDir) $(basename $spfDir) > /dev/null 2>&1
+		tar -rf $tempOutput $spfDir > /dev/null 2>&1
 		if [ $? != 0 ];then
 			printf "WARNING:\tError copying Postfix configuration (Continue)\n"
 		fi
@@ -524,7 +524,7 @@ function makeTar {
 	if [ $noOpenDMARC = false ];then
 		if [ -f $openDMARCConf ];then
 			printf "Adding:\t%s\n" $openDMARCConf
-			tar -rf $tempOutput -C $(dirname $openDMARCConf) $(basename $openDMARCConf) > /dev/null 2>&1
+			tar -rf $tempOutput $openDMARCConf > /dev/null 2>&1
 			if [ $? != 0 ];then
 				printf "WARNING:\tError copying OpenDMARC configuration (Continue)\n"
 			fi
@@ -533,7 +533,7 @@ function makeTar {
 		fi
 		if [ -f $openDMARCDefault ];then
 			printf "Adding:\t%s\n" $openDMARCDefault
-			tar -rf $tempOutput -C $(dirname $(dirname $openDMARCDefault)) $(basename $(dirname $openDMARCDefault))/$(basename $openDMARCDefault) > /dev/null 2>&1
+			tar -rf $tempOutput $openDMARCDefault > /dev/null 2>&1
 			if [ $? != 0 ];then
 				printf "WARNING:\tError copying OpenDMARC sockets configuration (Continue)\n"
 			fi
@@ -545,7 +545,7 @@ function makeTar {
 	#Copy Amavis
 	if [ $noAmavis = false ];then
 		printf "Adding:\t%s\n" $amavisDir
-		tar -rf $tempOutput -C $(dirname $amavisDir) $(basename $amavisDir) > /dev/null 2>&1
+		tar -rf $tempOutput $amavisDir > /dev/null 2>&1
 		if [ $? != 0 ];then
 			printf "WARNING:\tError copying Amavis configuration (Continue)\n"
 		fi
@@ -554,7 +554,7 @@ function makeTar {
 	#Copy SPAMAssassin
 	if [ $noSpamAssassin = false ];then
 		printf "Adding:\t%s\n" $spamAssassinDir
-		tar -rf $tempOutput -C $(dirname $spamAssassinDir) $(basename $spamAssassinDir) > /dev/null 2>&1
+		tar -rf $tempOutput $spamAssassinDir > /dev/null 2>&1
 		if [ $? != 0 ];then
 			printf "WARNING:\tError copying SPAM Assasin configuration (Continue)\n"
 		fi