[SOLVED] Unable to start CT using CRON

MACRM32

New Member
Oct 5, 2023
2
0
1
Hello everyone!

This is my first post here, so apologies if I get something wrong.

Here's my issue: I have a container running Folding@Home that I want to shutdown during the night to reduce noise levels.

My current cron looks like this:

Code:
0 9 * * * /usr/bin/lxc-start 5001

0 0 * * * lxc-stop 5001

No matter what I do, I cannot get the container to start, BUT it shuts down without any issue.

On the task log / journalctl I can see that the start command gets invoked, but I haven't found a way to post any possible errors to it.

Does anyone have any idea what the issue could be? The container is standalone, no external dependencies such as network shares or the like.

Thanks!
 
Hi, I've tried it as well, and it didn't work, although I didn't try it with the full path. Gonna experiment with that option.

EDIT: That worked, thanks!
The ability to run a command by only its name, without specifying path, is taking advantage of your Shell pre-set configuration. Specifically PATH variable. (man bash > search for ENVIRONMENT)
This variable can be set in multiple places (man bash > search FILES).

However, CRON has its own environment management system (man 5 crontab) and by default user environment is not loaded. So, unless you specifically define Cron variables, you should always use absolute paths to binaries, ie /usr/bin/ls


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox