This is new to me. I moved away from the plugins and did a manual install of Plex and Nextcloud using Dan’s script. Now i did a “pkg version” and see that there are a bunch of updates, mainly to php8.2. Is it wise to update very frequently or just once a quarter or so?
Also, do i need to stop the jail or stop services before doing so?
Of course my main concern is that i don’t want to break stuff.
It depends on which branch you’re on. If you are on the quarterly branch then those get updated every 3 months I believe. (Corrections if I’m wrong)
Latest branch will get latest updates so if you are on that you can do it more frequently.
I generally do this one every month or so. Unless there is a security issue with a package that requires immediate updates, my opinion is once a month should be fine.
#!/bin/bash
for JAIL in downloaders duplicati plex tautulli urbackup caddy deluge emby heimdall firefly jdownloader borg radarr
do
iocage exec $JAIL pkg upgrade -y
done
iocage exec plex service plexmediaserver restart
iocage exec emby service emby-server restart
for SERVICE in sabnzbd transmission nzbget
do
iocage exec downloaders service $SERVICE restart
done
for SERVICE in sonarr radarr
do
iocage exec radarr service $SERVICE restart
done
A more sophisticated version, that also upgraded the FreeBSD version, looked like this:
#!/bin/bash
VERSION=$(freebsd-version | sed 's|STABLE|RELEASE|g')
declare -a vars
eval "vars=(`/usr/local/bin/iocage list | awk '{ print $4 }' | sed '2d' | grep .`)"
for ((I = 0; I < ${#vars[@]}; ++I )); do
/usr/local/bin/iocage update "${vars[$I]}"
/usr/local/bin/iocage upgrade "${vars[$I]}" -r "$VERSION"
if /usr/local/bin/iocage exec "${vars[$I]}" "pkg upgrade" | grep -q 'Your packages are up to date.';
then
echo "No need to restart jails"
else
/usr/local/bin/iocage restart "${vars[$I]}"
fi
done