This commit is contained in:
2023-07-09 14:24:30 -05:00
parent 044b65c9e2
commit 16d1148d1c
2 changed files with 30 additions and 22 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
VERS='3.9.1-07092023'
VERS='3.9.4-07092023'
MMFOLDER="/opt/idssys/mediamanager"
TMPFOLDER="${MMFOLDER}/.tmp"

View File

@@ -978,26 +978,11 @@ UPDATESERVICE(){
echo -e "${idsCL[Green]}${usrvc^} Service has been updated${idsCL[Default]}"
else
sudo -iu user mkdir -p /home/user/.config/${usrvc^} >> ${LOGFOLDER}/update.${usrvc}
rm -f /etc/systemd/system/${usrvc}.service >> ${LOGFOLDER}/update.${usrvc}
# echo -e "${SYSTEMD_CONF[$usrvc]}" > /etc/systemd/system/${usrvc}.service
echo -e "[Unit]
Description=${usrvc^} Daemon
After=syslog.target network.target
[Service]
User=user
Group=users
Type=simple
ExecStart=/opt/${usrvc^}/${usrvc^} -nobrowser -data=/home/user/.config/${usrvc^}/
TimeoutStopSec=20
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
" > /etc/systemd/system/${usrvc}.service
systemctl daemon-reload >> ${LOGFOLDER}/update.${usrvc}
if [ "${ausrvc}" == "lidarr" ] || [ "${ausrvc}" == "radarr" ] || [ "${ausrvc}" == "radarr3d" ] || [ "${ausrvc}" == "prowlarr" ] || [ "${ausrvc}" == "readarr" ]; then
rm -f /etc/systemd/system/${usrvc}.service >> ${LOGFOLDER}/update.${usrvc}
CREATE_SYSTEMD_SERVICE ${ausrvc} >> ${LOGFOLDER}/update.${usrvc}
systemctl daemon-reload >> ${LOGFOLDER}/update.${usrvc}
fi
echo "$(date) - Installing Service (${usrvc}) : Completed" >> $logfile
echo -e "${idsCL[Green]}${usrvc^} Service has been Installed${idsCL[Default]}"
fi
@@ -1015,7 +1000,7 @@ WantedBy=multi-user.target
[ "${usrvc}" == "qbittorrent" ] && ausrvc="qbittorrent-nox" || ausrvc=${usrvc}
if [ "$(apt-get -s upgrade | grep ${ausrvc})" != "" ] || [ "${3}" == "-f" ]; then
[ "${3}" == "-f" ] && [ "$(apt-get -s upgrade | grep ${ausrvc})" == "" ] && echo -e "${idsCL[Green]}Update not needed, forcing anyway${idsCL[Default]}" || echo -e "${idsCL[Green]}Update Available${idsCL[Default]}"
[ "${3}" == "-f" ] && [ "$(apt-get -s upgrade | grep ${ausrvc})" == "" ] && echo -e "${idsCL[LightCyan]}Update not needed, forcing anyway${idsCL[Default]}" || echo -e "${idsCL[Green]}Update Available${idsCL[Default]}"
SERVICEBACKUP ${usrvc}
msg="Updating service"; c=0; spc=''; spc1=$((${cw_spc}-${#msg})); until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
@@ -1023,6 +1008,10 @@ WantedBy=multi-user.target
[ "${3}" == "-f" ] && [ "$(apt-get -s upgrade | grep ${ausrvc})" == "" ] && /usr/bin/apt install --reinstall ${ausrvc} -y >/dev/null 2>&1 || /usr/bin/apt install ${ausrvc} -y >/dev/null 2>&1
systemctl disable ${ausrvc} >/dev/null 2>&1
if [ "${ausrvc}" == "sonarr" ]; then
rm -f /lib/systemd/system/${ausrvc}.service >> ${LOGFOLDER}/update.${usrvc}
CREATE_SYSTEMD_SERVICE ${ausrvc} >> ${LOGFOLDER}/update.${usrvc}
fi
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
echo "$(date) - Updating Service (${usrvc}) : Completed" >> $logfile
@@ -1055,6 +1044,25 @@ WantedBy=multi-user.target
}
CREATE_SYSTEMD_SERVICE(){
srvc=${1}
echo -e "[Unit]
Description=${srvc^} Daemon
After=syslog.target network.target
[Service]
User=user
Group=users
Type=simple
ExecStart=/opt/${srvc^}/${srvc^} -nobrowser -data=/home/user/.config/${srvc^}/
TimeoutStopSec=20
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
" > /etc/systemd/system/${srvc}.service
}
SERVICEBACKUP(){
type pv >/dev/null 2>&1 || sudo apt -yq install pv >/dev/null 2>&1
usrvc=${1}