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 #!/usr/bin/env bash
VERS='3.8.242-07012023' VERS='3.8.244-07012023'
MMFOLDER="/opt/idssys/mediamanager" MMFOLDER="/opt/idssys/mediamanager"
TMPFOLDER="${MMFOLDER}/.tmp" TMPFOLDER="${MMFOLDER}/.tmp"
@@ -16,6 +16,7 @@ BETA_SERVICES=" "
IFS=, IFS=,
AVAIL_SERVICES=(${AVAILSERVICES}) AVAIL_SERVICES=(${AVAILSERVICES})
UPDATE_SERVICES=(${UPDATESERVICES}) UPDATE_SERVICES=(${UPDATESERVICES})
SERVICES_CHECK=(${SERVICESCHECK})
unset IFS unset IFS
noheader=' check noup update update-organizr cron ' noheader=' check noup update update-organizr cron '
@@ -148,3 +149,19 @@ uptime_minutes() {
done done
echo $minutes 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 DIVIDER . lightGreen
fi fi
IFS=,
SERVICES_CHECK=(${SERVICESCHECK})
unset IFS
cw_spc=40 cw_spc=40
@@ -875,6 +872,7 @@ VPNSPEEDTEST(){
UPDATESERVICE(){ UPDATESERVICE(){
if [ "${1}" == "service" ]; then if [ "${1}" == "service" ]; then
touch ${LOGFOLDER}/update.lastupdate
if [ "${2}" == "all" ]; then if [ "${2}" == "all" ]; then
for usrvc in "${UPDATE_SERVICES[@]}"; do for usrvc in "${UPDATE_SERVICES[@]}"; do
[ "${MM_UPDATE_REPO[${usrvc}]}" != "" ] && UPDATESERVICE service ${usrvc} ${3} [ "${MM_UPDATE_REPO[${usrvc}]}" != "" ] && UPDATESERVICE service ${usrvc} ${3}
@@ -930,14 +928,19 @@ UPDATESERVICE(){
latest_ver=`echo ${latest_release_url} | cut -d/ -f8` latest_ver=`echo ${latest_release_url} | cut -d/ -f8`
cver=${usrvc}_VER cver=${usrvc}_VER
if [ "${!cver}" != "${latest_ver}" ] || [ "${3}" == "-f" ]; then [ ! -d /opt/${usrvc^} ] && [[ " ${SERVICES_CHECK[*]} " =~ " ${usrvc} " ]] && INSTALLSRVC=true
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]}" [ "${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} # rm -f ${LOGFOLDER}/update.${usrvc}
touch ${LOGFOLDER}/update.${usrvc} touch ${LOGFOLDER}/update.${usrvc}
SERVICEBACKUP ${usrvc} if [ "${INSTALLSRVC}" != "true" ]; then
SERVICEBACKUP ${usrvc}
msg="Updating Service" msg="Updating Service"
else
msg="Installing Service"
fi
c=0; spc=''; spc1=$((${cw_spc}-${#msg})) c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done 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]}"
@@ -968,10 +971,19 @@ UPDATESERVICE(){
/bin/sed -i /${usrvc}/d ${TMPFOLDER}/vers.info /bin/sed -i /${usrvc}/d ${TMPFOLDER}/vers.info
echo "${usrvc}_VER=\"${latest_ver}\"" >> ${TMPFOLDER}/vers.info echo "${usrvc}_VER=\"${latest_ver}\"" >> ${TMPFOLDER}/vers.info
SERVICEBACKUPSTART ${usrvc} 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
echo "$(date) - Updating Service (${usrvc}) : Completed" >> $logfile SERVICEBACKUPSTART ${usrvc}
echo -e "${idsCL[Green]}${usrvc^} Service has been updated${idsCL[Default]}"
else else
echo -e "${idsCL[LightCyan]}Update Not Available${idsCL[Default]}" echo -e "${idsCL[LightCyan]}Update Not Available${idsCL[Default]}"