Script for shutting down NAS

Posted on
Wed Feb 01, 2017 6:38 am
Asconasny offline
Posts: 161
Joined: Jan 16, 2015

Script for shutting down NAS

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

Posted on
Wed Feb 01, 2017 9:19 am
Coolcaper offline
Posts: 299
Joined: Aug 30, 2013
Location: Australia

Script for shutting down NAS

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

Posted on
Wed Feb 01, 2017 12:23 pm
Asconasny offline
Posts: 161
Joined: Jan 16, 2015

Re: Script for shutting down NAS

yes please :)

Posted on
Wed Feb 01, 2017 7:32 pm
Coolcaper offline
Posts: 299
Joined: Aug 30, 2013
Location: Australia

Re: Script for shutting down NAS

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>"

Posted on
Sun Feb 05, 2017 8:03 am
Asconasny offline
Posts: 161
Joined: Jan 16, 2015

Re: Script for shutting down NAS

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

Posted on
Sun Feb 05, 2017 9:26 am
Coolcaper offline
Posts: 299
Joined: Aug 30, 2013
Location: Australia

Re: Script for shutting down NAS

No worries. Hopefully someone else can use it.


Sent from my iPhone using Tapatalk

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest