Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script to update all running LXC-Containers
#!/bin/bash
containers=$(sudo lxc-ls --running | sed ':a;N;$!ba;s/\n/ /g')
lxc_command="dpkg-reconfigure tzdata"
echo $lxc_command
for container in $containers; do
echo -e "\e[36m$container\e[0m"
sudo lxc-attach -n $container -- $lxc_command
done
#!/bin/bash
containers=$(sudo lxc-ls --running | sed ':a;N;$!ba;s/\n/ /g')
echo $test
for container in $containers; do
echo -e "\e[36m$container\e[0m"
echo -e "\e[33mupdate\e[0m"
sudo lxc-attach -n $container -- apt-get update
echo -e "\e[33mdist-upgrade\e[0m"
sudo lxc-attach -n $container -- apt-get dist-upgrade
echo -e "\e[33mautoremove\e[0m"
sudo lxc-attach -n $container -- apt-get autoremove --purge
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment