Skip to content

Instantly share code, notes, and snippets.

@zeraien
zeraien / power-safety.sh
Last active September 4, 2024 10:58
Shut down your "dumb" UPS-powered Synology when there is a power outage
#!/bin/bash
# If you are too cheap (like me) to buy an expensive "smart" UPS,
# this script will allow you to use a Raspberry Pi or any SSH-enabled device
# to automatically shut down your DiskStation when the Pi loses power.
# Meaning you simply plug the "heartbeat device" into regular power,
# and your DiskStation into a UPS, and when the regular power is dead,
# the heartbeat device will die thus your synology will be unable to reach it
# and shut down in due time (10min default).
# This script will check if a given ssh command responds