summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-11-10 13:37:35 +0100
committerErich Eckner <git@eckner.net>2017-11-10 13:38:30 +0100
commit970409c2b14473b26a4938cfb36939f4321edfb7 (patch)
tree7832128df79d324f2481c7e606ce654eec94e195
parent7c98067307218e3213cf8007afce0461d02b45f2 (diff)
downloadhardlinkedBackups-970409c2b14473b26a4938cfb36939f4321edfb7.tar.xz
backup: mehr ", zum wirklich aktuellen Datum umbenennen
-rwxr-xr-xbackup.in42
1 files changed, 23 insertions, 19 deletions
diff --git a/backup.in b/backup.in
index e468c0d..cba7bb5 100755
--- a/backup.in
+++ b/backup.in
@@ -79,10 +79,10 @@ then
exit 2
fi
-neues_Datum=${Basis}/$(date "+%Y_%m_%d")
-neues=${Basis}/aktuell
+neues_Datum="${Basis}/$(date "+%Y_%m_%d")"
+neues="${Basis}/aktuell"
linkdests=""
-for s in $(ls -1 ${Basis} | sort -r | grep -vm 20 aktuell )
+for s in $(ls -1 "${Basis}" | sort -r | grep -vxF -m 20 aktuell )
do
linkdests="${linkdests} --link-dest ${Basis}/${s}"
done
@@ -93,11 +93,11 @@ then
exit 3
fi
-[ -w ${Basis} ] || exit 11
-[ -e ${neues_Datum} ] && exit 4
-[ -e ${pidFile} ] && exit 5
+[ -w "${Basis}" ] || exit 11
+[ -e "${neues_Datum}" ] && exit 4
+[ -e "${pidFile}" ] && exit 5
-echo $$ > ${pidFile}
+echo $$ > "${pidFile}"
if [ -n "${tunnelBefehl}" ]
then
@@ -111,18 +111,18 @@ do
excludeArgs="${excludeArgs} --exclude ${toExclude}"
done
-if [ ! -e ${neues}/wip ]
+if [ ! -e "${neues}/wip" ]
then
- mkdir -p ${neues}/wip
+ mkdir -p "${neues}/wip"
fi
-chmod 750 ${neues}{,/wip}
-chown root:root ${neues}{,/wip}
+chmod 750 "${neues}"{,/wip}
+chown root:root "${neues}"{,/wip}
if [ -z "${rsyncShell}" ]
then
rsync ${rsyncOptions} \
${linkdests} \
${excludeArgs} \
- ${Quelle} ${neues}/wip/
+ ${Quelle} "${neues}/wip/"
sleep 1
rsync ${Quelle}
else
@@ -130,21 +130,25 @@ else
${rsyncOptions} \
${linkdests} \
${excludeArgs} \
- ${Quelle} ${neues}/wip/
+ ${Quelle} "${neues}/wip/"
sleep 1
rsync "${rsyncShell}" ${Quelle}
fi
erg=$?
-[ -n "${backgroundPid}" ] && kill ${backgroundPid}
+[ -n "${backgroundPid}" ] && kill "${backgroundPid}"
if [ ${erg} -eq 0 ] || [ ${erg} -eq 24 ]
then
- chmod o-rwx ${neues}/wip
- mv ${neues}/wip ${neues_Datum}
- rmdir ${neues}
- rm ${pidFile}
+ chmod o-rwx "${neues}/wip"
+ neueres_Datum="${Basis}/$(date "+%Y_%m_%d")"
+ if [ ! -e "${neueres_Datum}" ]; then
+ neues_Datum="${neueres_Datum}"
+ fi
+ mv "${neues}/wip" "${neues_Datum}"
+ rmdir "${neues}"
+ rm "${pidFile}"
else
- rm ${pidFile}
+ rm "${pidFile}"
exit 11
fi