I found as I replace more boxes with jails, that managing them is getting a little tougher. So I made a simple shell script to do a few things for me. I can update all my jails, remove all the auto update snapshots, execute a command in all the jails, and upgrade all the packages.
I haven't really tested this code much, and of course I have only used it on my setup.
Use this at your own risk!
#!/bin/sh # iocage helper script # by Michael Cole case $1 in 'exec') shift command="$@" if [ -z $command ] then echo "Please type a command." exit 1 fi echo "Prepairing to exec $command in all jails" for jail in $(iocage list | awk '{if (NR!=1) {print $5}}') do echo "Executing in jail: $jail" iocage exec $jail $command done ;; 'pkg-upgrade') echo "Prepairing to upgrade all packages in all jails" for jailid in $(jls | awk '{if (NR!=1) {print $1}}') do pkg -j $jailid upgrade done ;; 'removesnap') echo "Preparing to remove all update snapshows for all jails" for jail in $(iocage list | awk '{if (NR!=1) {print $5}}') do echo "Checking for update snapshots for $jail" for snap in $(iocage snaplist $jail | grep ioc-update | awk '{print $1}') do echo "Removing $jail@$snap" iocage snapremove $jail@$snap done done ;; 'update') echo "Preparing to update all jails" for jail in $(iocage list | awk '{if (NR!=1) {print $5}}') do echo "Updating $jail" iocage update $jail done ;; *) echo "$0 exec <command> - executes the command in all jails" echo "$0 pkg-upgrade - upgrade all packages in all jails" echo "$0 removesnap - remove all ioc-update snaps for all jails" echo "$0 update - update all jails" exit 1 ;;
Hopefully someone will enjoy this.