qm start command runs in script when started manually, but not when started in cron job

cmrho

New Member
Nov 4, 2024
22
5
3
I have a script to start a VM. It runs fine when I manually initiate the script. But when I run it in a cron job, I get a 'qm: command not found' error.

Does anyone have any ideas? Thanks!
 
  • Like
Reactions: cmrho and leesteken
Hi @cmrho ,
Your cron based job does not have all PATH components. This is the reason it cant find the "qm" command.
You either need to use absolute path to the binary, or define PATH in cron and/or your script.

Cheers

https://askubuntu.com/questions/47800/command-not-found-when-running-a-script-via-cron


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
Thanks! I added the following line to the top of the crontab

PATH=/usr/sbin:/usr/bin:/sbin:/bin

It works now.