≡ Menu

Shell script to update all lxd container hypervisor

A simple shell script wrapper to update all lxd container hypervisor images eitehr running Debian or Ubuntu Linux.

Run script as follows:
$ /path/to/update.lxd.vms
Sample outputs:

{ 5 comments… add one }
  • poxin December 10, 2016, 11:45 pm

    Cheers for this, really didn’t feel like writing one :)

  • deepthought August 21, 2016, 9:00 am

    Better and automated approach would be to install and configure unattended-upgrades on the containers

    • Vivek Gite August 21, 2016, 8:05 pm

      You can just call this script from a host with cron and all containers will get updated:

      @daily /path/to/this/lxc-update.sh
  • KEM August 14, 2016, 12:38 pm

    Thank you for publishing this, very helpful. For those of us learning bash scripts, could you break down this line? I think I understand what it does, but having the explanation would be great.
    Thanks
    clist="$(${_lxc} list -c ns | ${_awk} '!/NAME/{ if ( $4 == "RUNNING" ) print $2}')"

    • Vivek Gite August 20, 2016, 9:03 am

      1. Find list of running container lxc with list -c ns
      2. Use awk to print a list of container which are running but exclude header NAME with awk command

Security: Are you a robot or human?

Leave a Comment