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

    can we run simple bash sript in cron in xoa?

    Scheduled Pinned Locked Moved Xen Orchestra
    5 Posts 3 Posters 894 Views 2 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.
    • akurzawaA Offline
      akurzawa
      last edited by

      can we run simple bash sript in cron in xoa?

      I have almost oneliner to run by few secont to ask snmp (...). Is this possible tu put script somewhere in xoa? I don't want to multiple entitities.

      1 Reply Last reply Reply Quote 0
      • olivierlambertO Offline
        olivierlambert Vates 🪐 Co-Founder CEO
        last edited by

        Can you describe exactly the need? (to see if we can cover it in XO). Otherwise, I don't see any issue to use cron.

        1 Reply Last reply Reply Quote 0
        • akurzawaA Offline
          akurzawa
          last edited by akurzawa

          I wrote this script to monitor battery level via snmp, and in case low battery level I want to do some actions
          I guess I could put it directly in XCP but for best measures I want to avoid any non standard configuration changes - becaouse I'll later simply forget about it.

          #!/bin/bash
          
          UPSBatteryLevelCheck="$(snmpget -v1 -c public ups01 .1.3.6.1.4.1.43943.1.1.3.4.0| sed -n 's/.*INTEGER: //p')"
          
          if [ "$UPSBatteryLevelCheck" -lt "50" ]; then
          
          subject="Subject: Alert UPS01 - low battery level"
          body="UPS01 Battery Level below 50%"
          from="sen@d.er"
          to="em@a.il"
          echo -e "Subject:${subject}\n${body}" | sendmail -f "${from}" -t "${to}"
          
          fi
          
          1 Reply Last reply Reply Quote 0
          • nikadeN Offline
            nikade Top contributor
            last edited by

            Are you using XO from sources?
            If yes, this XO will run inside a regular VM and therefor I'd say yes, you can put this script into crontab.

            If you are using the XOA appliance I wouldnt recommend it just due to the fact that they could blame it incase anything goes wrong 😉

            1 Reply Last reply Reply Quote 0
            • akurzawaA Offline
              akurzawa
              last edited by

              I can put the script everywhere - but I want to avoid non standard config. In case of failure of {system} I'm reinstalling it, and restoring config from file. I don't need to remember that I've put some fancy staff somewhere on the lan.

              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