This script runs fine in the console, but fails to start the container in cron. So, lxc-stop will work fine in cron, but lxc-start won't
The cron message I receive is lxc-start wait_on_daemonized_start: 833 No such file or directory - Failed to receive the container state
for CONTAINER in $(lxc-ls -1 | grep data); do
lxc-stop --name=$CONTAINER
sleep 2
lxc-start --daemon --name=$CONTAINER
done
Any idea why it is only start that is failing in cron?
I had a very similar problem. The solution was to add the necessary PATH to cron. For me it was PATH=/usr/sbin:/usr/bin and then lxc-start did work. Hope it helps!