Edit: I’ll probably use the wifi connection as an indication of power outage:)

I got a UPS that apparenlty doesnt send a shutdown signal when power goes off from the mains. What could I do to let the server know ac power is off and gracefully shut down?

My ups: Powertech ​UPS 1150VA​ Line Inte​ractive PT​-1150LI https://www.skroutz.gr/s/23613693/Powertech-UPS-Line-Interactive-1150VA-690W-me-2-Schuko-Prizes.html

I’m thinking of somehow having a device sending an “on” signal when connected to the mains that when it is interrupted (like, gone for X amount of time) the server shuts down. Then also set my server to attempt to boot up automatically every half an hour.

  • notabot@piefed.social
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 month ago

    That’s a bit of a peculiar UPS, I think it’s designed for supporting non-computer loads and so doesn’t have the signaling port.

    If you try to have your server automatically power back up be aware that the UPS battery may be depleated and so if the power drops again before it’s charged, it’ll take the server down. You might be better off enabling wake-on-lan and having a small device (a raspberry pi or similar maybe) that runs off of the mains. Your server can ping it and shutdown if it loses connection, and the device can send a wake-on-lan packet a while after power is restored to allow the battery to recharge a bit first.

    • Blastboom Strice@mander.xyzOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 month ago

      Yeah I guess its for non-computer loads indeed:/

      The wake on lan is a good idea, but I have a feeling it may not work well over wifi (yeah Im using wifi for internet💀), but I could use a wifi extender with ethernet output.

      Either way, for powering on I saw that asrock (and many other motherboards) has an option to turn on the pc after ac outage so I might use it

      For turning off I’ll have it periodically ping my isp’s dns or something and if theres no connection for some time it’ll shut down or at least go into sleep mode.

      (I’ll include my build specs in the post)

      • notabot@piefed.social
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 month ago

        If you have the machine turn on when AC is restored the UPS battery will still not have recharged, and if you have a second power cut or another glitch (not unlikely if it’s an intermittent fault upstream of you) the UPS will not be able to supply power, so your server will suddenly lose power.

        UPSs for computers usually delay restoring power to their load until their battery is recharged at least a certain amount. It doesn’t look like yours has a control for that, but if it does you might be OK, otherwise you’ll want to make the delay happen some other way. You could connect a Pi directly into your server’s ethernet port with a cross over cable and do WoL through that.

        • Blastboom Strice@mander.xyzOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 month ago

          A pi and a wifi extender with ethernet output (I think I have the latter) would probably complete this setup, but hmm Im already over budget and too bored to buy and set up a pi right now. Maybe I’ll do it that way in the future.

          At least where the server is rarely ever there power outages, let alone concurent power outages.