@lem2405
Sorry for any confusion. Hope this clears it up.
The credentials in xo-config.cfg are 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 -c
Then add --non-interactive so it doesn't stop to ask anything:
0 3 * * * cd /path/to/install_xen_orchestra && ./install-xen-orchestra.sh --update --non-interactive
Keep in mind this gives that account full sudo with no password. Use at your own risk.
I have just push this change the readme.md on the dev branch...
Scheduled Updates (cron)
--update can 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 calls sudo throughout, 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 -c
This 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) in xo-config.cfg.
Without it, a non-interactive run skips the
running task check instead of
prompting for credentials.