Page 1 of 1

Script for shutting down NAS

PostPosted: Wed Feb 01, 2017 6:38 am
by Asconasny
Hi
Anyone have a script for shutting down a Nas or similar via telnet or ssh?
or can give me any pointers how to do it.

My Indigo is connected to a ups with apcupsd running.
The nas is connected to the same UPS.

What i would like to do us make a trigger ONbattery, and shut the nas gracefully down.

Then use WOL to start it up again when power is restored.

Regards
Asconasny

Script for shutting down NAS

PostPosted: Wed Feb 01, 2017 9:19 am
by Coolcaper
I have one for the Netgear ReadyNas104 although it's not python. Let me know if you'd like that one. Late here now so have to dig it up.


Sent from my iPhone using Tapatalk

Re: Script for shutting down NAS

PostPosted: Wed Feb 01, 2017 12:23 pm
by Asconasny
yes please :)

Re: Script for shutting down NAS

PostPosted: Wed Feb 01, 2017 7:32 pm
by Coolcaper
Here you go. Its specific to netgear readynas so hopefully yours is the same and it works. As usual substitute your username and password for user:password and your IP address after the https: but everything else remains the same:

curl -u user:password -k "https://10.0.1.5/dbbroker" -H "Content-Type: application/x-www-form-urlencoded;" -H "X-Requested-With: XMLHttpRequest" --data "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xs:nml xmlns:xs=\"http://www.netgear.com/protocol/transaction/NMLSchema-0.9\" xmlns=\"urn:netgear:nas:readynasd\" src=\"dpv_1445852944000\" dst=\"nas\"><xs:transaction id=\"njl_id_2269\"><xs:custom id=\"njl_id_2268\" name=\"Halt\" resource-id=\"Shutdown\" resource-type=\"System\"><Shutdown halt=\"true\" fsck=\"false\"/></xs:custom></xs:transaction></xs:nml>"

Re: Script for shutting down NAS

PostPosted: Sun Feb 05, 2017 8:03 am
by Asconasny
Hi.
Thank you :)

Unfortunately , i could not use this, i have a synology.
But i figured it out, had to set up rsa key login as root on the nas, then i made a bash script that indigo runs when it detects Onbattery.

regards
Asconasny

Re: Script for shutting down NAS

PostPosted: Sun Feb 05, 2017 9:26 am
by Coolcaper
No worries. Hopefully someone else can use it.


Sent from my iPhone using Tapatalk