Update mm-scripts.sh
This commit is contained in:
@@ -1071,6 +1071,13 @@ WantedBy=multi-user.target
|
|||||||
SERVICEBACKUP(){
|
SERVICEBACKUP(){
|
||||||
type pv >/dev/null 2>&1 || sudo apt -yq install pv >/dev/null 2>&1
|
type pv >/dev/null 2>&1 || sudo apt -yq install pv >/dev/null 2>&1
|
||||||
usrvc=${1}
|
usrvc=${1}
|
||||||
|
|
||||||
|
if [ "${usrvc}" == "all" ]; then
|
||||||
|
for uasrvc in "${UPDATE_SERVICES[@]}"; do
|
||||||
|
[ "${MM_UPDATE_REPO[${uasrvc}]}" != "" ] && [[ " ${SERVICES_CHECK[*]} " =~ " ${uasrvc} " ]] && SERVICEBACKUP ${uasrvc} ${2}
|
||||||
|
done
|
||||||
|
|
||||||
|
elif [ "${usrvc}" != "" ]; then
|
||||||
msg="Stopping Service and Backing Up"; c=0; spc=''; spc1=$((${cw_spc}-${#msg})); until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
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]}"
|
echo -en "${idsCL[White]}${msg}${spc} : ${idsCL[Default]}"
|
||||||
/bin/systemctl stop ${usrvc} >> ${LOGFOLDER}/update.${usrvc}
|
/bin/systemctl stop ${usrvc} >> ${LOGFOLDER}/update.${usrvc}
|
||||||
@@ -1086,19 +1093,21 @@ SERVICEBACKUP(){
|
|||||||
([ $(expr `date +%s` - $(stat -c %Y ${LOGFOLDER}/update.${usrvc})) -gt 604800 ] && [ $(expr `date +%s` - $(stat -c %Y ${BACKUPDIR}/fullbackup)) -gt 7776000 ]); then
|
([ $(expr `date +%s` - $(stat -c %Y ${LOGFOLDER}/update.${usrvc})) -gt 604800 ] && [ $(expr `date +%s` - $(stat -c %Y ${BACKUPDIR}/fullbackup)) -gt 7776000 ]); then
|
||||||
if [ "${MM_SERVICE_APP[$usrvc]}" != "none" ]; then
|
if [ "${MM_SERVICE_APP[$usrvc]}" != "none" ]; then
|
||||||
rm -f ${BACKUPDIR}/snapshot-apt.snar
|
rm -f ${BACKUPDIR}/snapshot-apt.snar
|
||||||
tar -cpPg ${BACKUPDIR}/snapshot-apt.snar -f ${BACKUPDIR}/app-full.tgz ${APPBAKFOLDER}
|
tar -cg ${BACKUPDIR}/snapshot-apt.snar -f ${BACKUPDIR}/app-full.tgz ${APPBAKFOLDER}
|
||||||
fi
|
fi
|
||||||
if [ "${MM_SERVICE_CFG[${usrvc}]}" != "" ] && [ -d ${MM_SERVICE_CFG[${usrvc}]} ]; then
|
if [ "${MM_SERVICE_CFG[${usrvc}]}" != "" ] && [ -d ${MM_SERVICE_CFG[${usrvc}]} ]; then
|
||||||
rm -f ${BACKUPDIR}/snapshot-cfg.snar
|
rm -f ${BACKUPDIR}/snapshot-cfg.snar
|
||||||
tar -cpPg ${BACKUPDIR}/snapshot-cfg.snar -f ${BACKUPDIR}/cfg-full.tgz ${MM_SERVICE_CFG[${usrvc}]}
|
rm -f ${BACKUPDIR}/snapshot-cfg-3d.snar
|
||||||
|
tar -cg ${BACKUPDIR}/snapshot-cfg.snar -f ${BACKUPDIR}/cfg-full.tgz ${MM_SERVICE_CFG[${usrvc}]}
|
||||||
|
[ "${usrvc}" == "radarr" ] && tar -cg ${BACKUPDIR}/snapshot-cfg-3d.snar -f ${BACKUPDIR}/cfg-3d-full.tgz ${MM_SERVICE_CFG['radarr3d']}
|
||||||
fi
|
fi
|
||||||
touch ${BACKUPDIR}/fullbackup
|
touch ${BACKUPDIR}/fullbackup
|
||||||
else
|
else
|
||||||
if [ "${MM_SERVICE_APP[$usrvc]}" != "none" ]; then
|
if [ "${MM_SERVICE_APP[$usrvc]}" != "none" ]; then
|
||||||
tar -cpPg ${BACKUPDIR}/snapshot-apt.snar -f ${BACKUPDIR}/app.$(date +%y-%m-%d-%H-%M-%S).tgz ${APPBAKFOLDER}
|
tar -cg ${BACKUPDIR}/snapshot-apt.snar -f ${BACKUPDIR}/app.$(date +%y-%m-%d-%H-%M-%S).tgz ${APPBAKFOLDER}
|
||||||
fi
|
fi
|
||||||
if [ "${MM_SERVICE_CFG[${usrvc}]}" != "" ] && [ -d ${MM_SERVICE_CFG[${usrvc}]} ]; then
|
if [ "${MM_SERVICE_CFG[${usrvc}]}" != "" ] && [ -d ${MM_SERVICE_CFG[${usrvc}]} ]; then
|
||||||
tar -cpPg ${BACKUPDIR}/snapshot-cfg.snar -f ${BACKUPDIR}/cfg.$(date +%y-%m-%d-%H-%M-%S).tgz ${MM_SERVICE_CFG[${usrvc}]}
|
tar -cg ${BACKUPDIR}/snapshot-cfg.snar -f ${BACKUPDIR}/cfg.$(date +%y-%m-%d-%H-%M-%S).tgz ${MM_SERVICE_CFG[${usrvc}]}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -1111,6 +1120,7 @@ SERVICEBACKUP(){
|
|||||||
|
|
||||||
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
|
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
SERVICEBACKUP.old(){
|
SERVICEBACKUP.old(){
|
||||||
usrvc=${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
|
msg="Stopping Service and Backing Up"; c=0; spc=''; spc1=$((${cw_spc}-${#msg})); until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||||
|
|||||||
Reference in New Issue
Block a user