This commit is contained in:
2023-07-08 20:14:47 -05:00
parent 43770b3f36
commit 4205fcf760
2 changed files with 41 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
VERS='3.8.242-07012023'
VERS='3.8.244-07012023'
MMFOLDER="/opt/idssys/mediamanager"
TMPFOLDER="${MMFOLDER}/.tmp"
@@ -16,6 +16,7 @@ BETA_SERVICES=" "
IFS=,
AVAIL_SERVICES=(${AVAILSERVICES})
UPDATE_SERVICES=(${UPDATESERVICES})
SERVICES_CHECK=(${SERVICESCHECK})
unset IFS
noheader=' check noup update update-organizr cron '
@@ -148,3 +149,19 @@ uptime_minutes() {
done
echo $minutes
}
declare -A SYSTEMD_CONF
SYSTEMD_CONF['prowlarr']="[Unit]
Description=Prowlarr Daemon
After=syslog.target network.target
[Service]
User=user
Group=users
Type=simple
ExecStart=/opt/Prowlarr/Prowlarr -nobrowser -data=/home/user/.config/Prowlarr/
TimeoutStopSec=20
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
"

View File

@@ -33,9 +33,6 @@ if [[ "${noheader}" != *" ${1} "* ]] && [[ "${noheader}" != *" ${2} "* ]] || ([
DIVIDER . lightGreen
fi
IFS=,
SERVICES_CHECK=(${SERVICESCHECK})
unset IFS
cw_spc=40
@@ -875,6 +872,7 @@ VPNSPEEDTEST(){
UPDATESERVICE(){
if [ "${1}" == "service" ]; then
touch ${LOGFOLDER}/update.lastupdate
if [ "${2}" == "all" ]; then
for usrvc in "${UPDATE_SERVICES[@]}"; do
[ "${MM_UPDATE_REPO[${usrvc}]}" != "" ] && UPDATESERVICE service ${usrvc} ${3}
@@ -929,15 +927,20 @@ UPDATESERVICE(){
fi
latest_ver=`echo ${latest_release_url} | cut -d/ -f8`
cver=${usrvc}_VER
[ ! -d /opt/${usrvc^} ] && [[ " ${SERVICES_CHECK[*]} " =~ " ${usrvc} " ]] && INSTALLSRVC=true
if [ "${!cver}" != "${latest_ver}" ] || [ "${3}" == "-f" ]; then
if [ "${INSTALLSRVC}" == "true" ] || [ "${!cver}" != "${latest_ver}" ] || [ "${3}" == "-f" ]; then
[ "${3}" == "-f" ] && echo -e "${idsCL[LightCyan]}Update Not Needed, forcing anyway${idsCL[Default]}" || echo -e "${idsCL[Green]}Update Available${idsCL[Default]}"
# rm -f ${LOGFOLDER}/update.${usrvc}
touch ${LOGFOLDER}/update.${usrvc}
SERVICEBACKUP ${usrvc}
msg="Updating Service"
if [ "${INSTALLSRVC}" != "true" ]; then
SERVICEBACKUP ${usrvc}
msg="Updating Service"
else
msg="Installing Service"
fi
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]}"
@@ -967,12 +970,21 @@ UPDATESERVICE(){
[ ! -f ${TMPFOLDER}/vers.info ] && touch ${TMPFOLDER}/vers.info
/bin/sed -i /${usrvc}/d ${TMPFOLDER}/vers.info
echo "${usrvc}_VER=\"${latest_ver}\"" >> ${TMPFOLDER}/vers.info
if [ "${INSTALLSRVC}" != "true" ]; then
echo "$(date) - Updating Service (${usrvc}) : Completed" >> $logfile
echo -e "${idsCL[Green]}${usrvc^} Service has been updated${idsCL[Default]}"
else
mkdir -p /home/user/.config/Prowlarr
rm -f /etc/systemd/system/${usrvc}.service
echo ${SYSTEMD_CONF[$usrvc]} > /etc/systemd/system/${usrvc}.service
systemctl dameon-reload
echo "$(date) - Installing Service (${usrvc}) : Completed" >> $logfile
echo -e "${idsCL[Green]}${usrvc^} Service has been Installed${idsCL[Default]}"
fi
SERVICEBACKUPSTART ${usrvc}
echo "$(date) - Updating Service (${usrvc}) : Completed" >> $logfile
echo -e "${idsCL[Green]}${usrvc^} Service has been updated${idsCL[Default]}"
else
echo -e "${idsCL[LightCyan]}Update Not Available${idsCL[Default]}"
echo "$(date) - Updating Service (${usrvc}) : Update Not Needed" >> $logfile