XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Install XO from sources.

    Scheduled Pinned Locked Moved Xen Orchestra
    44 Posts 11 Posters 9.3k Views 12 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      lem2405 @acebmxer
      last edited by

      @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.

      acebmxerA 1 Reply Last reply
      Reply Quote 0
      • acebmxerA
        acebmxer @lem2405
        last edited by acebmxer

        @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've pushed this to the dev branch, including a new Scheduled Updates (cron) section in the README. To try it before it reaches main, switch your copy to dev:

        cd /path/to/install_xen_orchestra
        git fetch origin
        git checkout dev
        

        To go back later, run git checkout main.

        Scheduled Updates (cron)

        --update can run unattended from cron. Two things are needed:

        1. 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.

        2. --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.

        L 1 Reply Last reply
        Reply Quote 0
        • L
          lem2405 @acebmxer
          last edited by

          @acebmxer Thank you for your help and prompt response. I truly appreciate it!

          acebmxerA 1 Reply Last reply
          Reply Quote 0
          • acebmxerA
            acebmxer @lem2405
            last edited by

            @lem2405

            No problem. Let me know if you still encounter any issues.

            1 Reply Last reply
            Reply Quote 0

            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
            • First post
              Last post