How to backup and restore LXD containers - problems with cronjob

,

Hello - thanks for the article - works perfect. But …

  • I can’t get the script working with a cronjob - how to do this? I tried it as root as well as the LXD/LXC user and it always reports “unknown lxc commands” regarding the loop “for i in $(lxc list -c n --format csv)” in my log file and does nothing…
    Any hints?
    Best regards ECF

Either set up $PATH in your script or specify the full path to lxc.

type -a lxc

Then, you should see something as follows:

[vivek@nixcraft-wks01 ~]$ type -a lxc
lxc is /usr/bin/lxc
lxc is /bin/lxc
lxc is /snap/bin/lxc

Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki