Script to update all running LXC-Containers
This file contains 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/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 |
This file contains 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/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