Created
November 15, 2012 11:52
-
-
Save meise/4078263 to your computer and use it in GitHub Desktop.
Running security updates on debian based systems managed with libvirt and accessible via ssh.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Running security updates on debian based systems managed with libvirt and | |
# accessible via ssh. | |
# Tmux, virsh and ssh are needed for this script. | |
vms=`virsh list --name` | |
if [ -z "$TMUX" ]; then | |
echo "Create tmux session before installing updates:" | |
echo " tmux new" | |
exit 1 | |
else | |
echo Update VMs ${vms}. | |
echo | |
for vm in $vms; do | |
tmux new-window -n $vm "ssh $vm '\ | |
aptitude update && \ | |
aptitude safe-upgrade && \ | |
echo && \ | |
echo Updating done && \ | |
sleep 60'" | |
done | |
echo "Check tmux tabs for interaction." | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you don't want to bother checking if the upgrades are good (this has become sort of feasible with apt-key), have a look at
unattended-upgrades
.