Update mm-scripts.sh

This commit is contained in:
2023-07-09 10:46:39 -05:00
parent 6a6abd89c3
commit 1e7a57c27b

View File

@@ -1053,7 +1053,7 @@ WantedBy=multi-user.target
}
SERVICEBACKUP(){
type pv >/dev/null 2>&1 || sudo apt -y install pv
type pv >/dev/null 2>&1 || sudo apt -yq install pv >/dev/null 2>&1
usrvc=${1}
msg="Stopping Service and Backing Up"; c=0; spc=''; spc1=$((${cw_spc}-${#msg})); until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
echo -en "${idsCL[White]}${msg}${spc} : ${idsCL[Default]}"
@@ -1069,21 +1069,21 @@ SERVICEBACKUP(){
NOW=`date +%d-%b`
if [ "${MM_SERVICE_APP[$usrvc]}" != "none" ]; then
echo ${NOW} > ${BACKUPDIR}/app-full-date
/bin/tar ${NEWER} cf - -C ${APPBAKFOLDER}/* | pv -s $(du -sb ${APPBAKFOLDER} | awk '{print $1}') | gzip > ${BACKUPDIR}/app.tgz
/bin/tar ${NEWER} cpPf - -C ${APPBAKFOLDER}/* | pv -s $(du -sb ${APPBAKFOLDER} | awk '{print $1}') | gzip > ${BACKUPDIR}/app.tgz
fi
if [ "${MM_SERVICE_CFG[${usrvc}]}" != "" ] && [ -d ${MM_SERVICE_CFG[${usrvc}]} ]; then
echo ${NOW} > ${BACKUPDIR}/cfg-full-date
/bin/tar ${NEWER} cf - -C ${MM_SERVICE_CFG[${usrvc}]}/* | pv -s $(du -sb ${MM_SERVICE_CFG[${usrvc}]} | awk '{print $1}') | gzip > ${BACKUPDIR}/cfg.tgz
/bin/tar ${NEWER} cpPf - -C ${MM_SERVICE_CFG[${usrvc}]}/* | pv -s $(du -sb ${MM_SERVICE_CFG[${usrvc}]} | awk '{print $1}') | gzip > ${BACKUPDIR}/cfg.tgz
fi
else
if [ "${MM_SERVICE_APP[$usrvc]}" != "none" ]; then
NEWER="--newer `cat ${BACKUPDIR}/app-full-date`"
/bin/tar $NEWER cf - -C ${APPBAKFOLDER}/* | pv -s $(du -sb ${APPBAKFOLDER} | awk '{print $1}') | gzip > ${BACKUPDIR}/app.${NOW}.tgz
/bin/tar $NEWER cpPf - -C ${APPBAKFOLDER}/* | pv -s $(du -sb ${APPBAKFOLDER} | awk '{print $1}') | gzip > ${BACKUPDIR}/app.${NOW}.tgz
fi
if [ "${MM_SERVICE_CFG[${usrvc}]}" != "" ] && [ -d ${MM_SERVICE_CFG[${usrvc}]} ]; then
NEWER="--newer `cat ${BACKUPDIR}/cfg-full-date`"
/bin/tar $NEWER cf - -C ${MM_SERVICE_CFG[${usrvc}]}/* | pv -s $(du -sb ${MM_SERVICE_CFG[${usrvc}]} | awk '{print $1}') | gzip > ${BACKUPDIR}/cfg.${NOW}.tgz
/bin/tar $NEWER cpPf - -C ${MM_SERVICE_CFG[${usrvc}]}/* | pv -s $(du -sb ${MM_SERVICE_CFG[${usrvc}]} | awk '{print $1}') | gzip > ${BACKUPDIR}/cfg.${NOW}.tgz
fi
fi