Skip to content

Instantly share code, notes, and snippets.

@dadosch
Created May 22, 2017 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dadosch/a48c61b9fe130d5384e52a7b6e5e1367 to your computer and use it in GitHub Desktop.
Save dadosch/a48c61b9fe130d5384e52a7b6e5e1367 to your computer and use it in GitHub Desktop.
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