I have my hubs set to safely shutdown when my NAS shuts down (NAS shuts down due to power loss, the hubs will too).

I have the hubs powered by PoE.

I would like to power cycle the specific PoE ports from the NAS when the NAS boots up (power restored), to restart them after power is restored.

Any ideas how I could do this?

First thought I get is that you need to find if the PoE switch supports external commands. Maybe through a REST api or some other maintenance/Management tool.
The command to look for would be to shut port down, and then on again.

Every switch manufacturer do this different, and it also depends on if the switch support management or not.

Switch model /maker?


UniFi SW-48
Doesn’t support REST

I guess I’m trying to figure how to use SSH and Telnet from the shell to use the CLI. I can do it, I just haven’t been successful using Synology to issue the commands within a script.

If there is a simple series of steps from a menu needed to turn a port on and off, you might try installing "expect" on the Synology. Expect just waits for the menu and then issues the next command, waits until the next step, issues the command and so on. Great for text menus that have no way to script. You will likely need to set up a public key login for ssh.

1 Like

Won't the Unifi POE switch loose power when the UPS shuts down effectively rebooting all ports when it comes back up anyway? Or are you looking for a way to automate the times when it has already shutdown the hub and the power came back on before the UPS ran out of power?

I already have a way to shut them down safely. I just need a way to restart them by power cycling PoE.

I don't have any Unifi switches so I have no idea if this is possible - is there any way to issue remote commands to the controller? I don't even know if you could do what you want from the controller . . . there is some kind of remote access but I have never tried it.

This could be useful to you.

I found that. Unfortunately there doesn’t appear to be a way to install sshpass onto a Synology NAS.

For anyone trying to automate the restart (after a safe shutdown) by power cycling the PoE ports, here is how I did it.

I used Docker and installed the container smartcommunitylab/expect:latest.
I mounted a directory on the NAS containing the script so the container could access it.
I exported the settings and changed cmd to "cmd" : "/bin/bash /hub/",
I imported the new settings. At this point running the container runs the script.
I set it so that when the NAS powers up after a power failure (safe shutdown via UPS), the hubs will boot up too.

Note: the first time through the script you have to deal with the RSA key by replying yes. After which, you can remove that.

1 Like

Hi. I realize this is a old thread. I just bought a DS220+ last month and have it up and running for the real reason to have a NAS - backing up four computers and my drive with three users etc.

I am new to Synoloyg - my last NAS was a Seagate cloud box (I know, not really a NAS)

Is the best place to learn about docker and containers or is there a better site aimed at smart home integration.

I know there is a thread on this forum re: backing up HE that I plan to follow. I am currently tweaking my Rachio integration so haven got to it yet.

I have a ups plugged into my ds220 but I of course have to figure out how to shut things down before I worry about powering them back up.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.