Install XO from sources.
-
@acebmxer Even with the credentials present in the configuration file, the process still prompts for sudo permissions, which will not be visible or actionable when running as a cron job.
-
Sorry for any confusion. Hope this clears it up.
The credentials in
xo-config.cfgare only for logging into Xen Orchestra (the pre-update task check and VM snapshot). There is no setting for a sudo password, and the script won't run as root, so sudo will still ask.To run it from cron, the account running the script needs passwordless sudo. Run this as that user:
echo "$USER ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/xo-cron sudo chmod 440 /etc/sudoers.d/xo-cron sudo visudo -cThen add
--non-interactiveso it doesn't stop to ask anything:0 3 * * * cd /path/to/install_xen_orchestra && ./install-xen-orchestra.sh --update --non-interactiveKeep in mind this gives that account full sudo with no password. Use at your own risk.
I've pushed this to the
devbranch, including a new Scheduled Updates (cron) section in the README. To try it before it reachesmain, switch your copy todev:cd /path/to/install_xen_orchestra git fetch origin git checkout devTo go back later, run
git checkout main.Scheduled Updates (cron)
--updatecan run unattended from cron. Two things are needed:-
Passwordless sudo for the account that runs the script. The script
refuses to run as root and callssudothroughout, and there is no config
setting for a sudo password. Run this as that account:echo "$USER ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/xo-cron sudo chmod 440 /etc/sudoers.d/xo-cron sudo visudo -cThis gives the account full sudo with no password.
-
--non-interactive, so the update never stops to ask anything:0 3 * * * cd /path/to/install_xen_orchestra && ./install-xen-orchestra.sh --update --non-interactive >> "$HOME/xo-update.log" 2>&1
Set
XO_API_TOKEN(or the user/password pair) inxo-config.cfg.
Without it, a non-interactive run skips the
running task check instead of
prompting for credentials. -
-
@acebmxer Thank you for your help and prompt response. I truly appreciate it!
-
No problem. Let me know if you still encounter any issues.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login