D-Link Forums
The Graveyard - Products No Longer Supported => D-Link Storage => DNS-323 => Topic started by: AndyB on September 30, 2009, 04:44:09 AM
-
Hi,
I assume that I'm not the only one having this problem:
More then DNS-323 and just one UPS (with USB Signalling) so - only the NAS attached to the UPS via USB will shutdown automatically.
I created a simple shutdown script for windows.
It allows you to shutdown the NAS via wget (windows build) and 2 http calls.
Wget (all in one binary - no libraries needed)
Download for Win32: http://users.ugent.be/~bpuype/wget/ (http://users.ugent.be/~bpuype/wget/)
thanks to Bart Puype for the wget build ;-)
When the main server shuts down due to a UPS Command, the script is called by the UPS Software during shutdown.
Cheers,
AndyB
Just copy the following lines to notepad and save as nas_shutdown.bat
@echo off
rem --- D-Link DNS-323 Shutdown Script
rem --- created by Andreas Baumgärtner
rem --- version 1.0
rem --- 20090930
rem --- Info:
rem --- don't change the uname!!
rem --- change passwd and ip to your needs
rem --- timeout is in seconds adjust it to your needs - for me 5 seconds where enough
rem --- only one try otherwise the script could delay the shutdown for too long
echo Shutting down NAS_002 ...
set UNAME=admin
set PASSWD=yourpassword
set IP=172.17.0.6
wget --tries=1 --timeout=5 "http://%IP%/goform/formLogin?f_login_type=0&f_LOGIN_NAME=%UNAME%&f_LOGIN_PASSWD=%PASSWD%"
IF %ERRORLEVEL%==0 (
wget --tries=1 --timeout=5 "http://%IP%/goform/sysShutDown?shootdown"
) ELSE (
echo Unable to shutdown NAS_002
)
echo Shutting down NAS_001 ...
set UNAME=admin
set PASSWD=yourpassword2
set IP=172.17.0.5
wget --tries=1 --timeout=5 "http://%IP%/goform/formLogin?f_login_type=0&f_LOGIN_NAME=%UNAME%&f_LOGIN_PASSWD=%PASSWD%"
IF %ERRORLEVEL%==0 (
wget --tries=1 --timeout=5 "http://%IP%/goform/sysShutDown?shootdown"
) ELSE (
echo Unable to shutdown NAS_001
)
SET IP=
SET PASSWD=
SET UNAME=
-
If there was a usefulness rating on threads in this forum and 10 = Absolutely Amazing ...
I'd give this thread a 8.99.
... I never give out 9's & 10's ;)
Nicely done,
:)
-
Nice, I'm going to give it a try tonight.
-
Sweet!!
-
Fantastic! That's exactly what I'm looking for...
Thank you for this AndyB!
-
Hi,
thank a lot for your suggestion; I'm in a different situation, I have only one DNS-323 and not plugged on the UPS. I tried this script but it doesn't works, even if I put off the line from ") else (" and I changed the name of the NAS (rigth name is NASCasa).
Any suggestions ?
Thanks a lot in advance
Gianni
-
Hi,
thank a lot for your suggestion; I'm in a different situation, I have only one DNS-323 and not plugged on the UPS. I tried this script but it doesn't works, even if I put off the line from ") else (" and I changed the name of the NAS (rigth name is NASCasa).
Any suggestions ?
Thanks a lot in advance
Gianni
...any comment ?
-
Hi Gianni,
I sent you an email offline on monday - no reply so far from you ...
Just to be very clear - the script will work with DNS-323 with our without UPS connection. I created the script out of this usecase ...
Requirements:
you need wget downloaded and working (in same directory as the script or in the path).
the name of the nas is irrelevant. you only need to alter 2 lines in the script:
set PASSWD=yourpassword <--- put your password here (attention to spaces)
set IP=172.17.0.6 <--- put the IP of the NAS you want to shutdown here
Some additional questions:
DNS-323 Firmware?
What OS are you using?
Cheers,
Andi
-
Thanks for this, this is exactly what I had been looking for.
Sorry for revive a 6+ month old thread, but when I tried this it didn't work at first, and the reason was simple: I was logged in through the web interface to the DNS-323. The output from the script did not indicate any error that I could see though I did find it weird that there was no delay at all when it was trying to log in.
After I logged off from the web interface, the script successfully shut down the DNS-323. Just thought this little bit of information could be useful to some people. :)
-
I tried this script but it doesn't work for me:
Firmware - 1.10
FFP_VERSION=0.7.1
FFP_ARCH=oarm
Is there a newer one out, or another way to accomplish this?
-
Hi there,
I'm looking for use your script on Linux machine (raspberry with raspbian), so I tried to convert your script, but I have a problem with variable ERRORLEVEL. My script is:
#/bin/bash
echo D-Link DNS-323 Shutdown Script
echo created by Andreas Baumgärtner
echo version 1.0
echo 20090930
#Info:
#don't change the uname!!
#change passwd and ip to your needs
#timeout is in seconds adjust it to your needs - for me 5 seconds where enough
#only one try otherwise the script could delay the shutdown for too long
echo Shutting down NAS ...
UNAME=admin
PASSWD=yourpassword
IP=172.17.0.6
wget --tries=1 --timeout=5 "http://$IP/goform/formLogin?f_login_type=0&f_LOGIN_NAME=$UNAME&f_LOGIN_PASSWD=$PASSWD"
IF $ERRORLEVEL==0 (
wget --tries=1 --timeout=5 "http://$IP/goform/sysShutDown?shootdown"
) ELSE (
echo Unable to shutdown NAS
)
Anyone can help me on converting this script?
It works fine untile the ERRORLEVEL variable.
Thanks.
-
Hi,
I might be able to use this with DNR 322L, but wget is not available from the link anymore.
wget not available: http://users.ugent.be/~bpuype/wget/ (http://users.ugent.be/~bpuype/wget/)
can I have a copy again, anybody?
Once I got, wget, where do I place it?
and Also where do I place the Script?
Thanks..
Hi,
I assume that I'm not the only one having this problem:
More then DNS-323 and just one UPS (with USB Signalling) so - only the NAS attached to the UPS via USB will shutdown automatically.
I created a simple shutdown script for windows.
It allows you to shutdown the NAS via wget (windows build) and 2 http calls.
Wget (all in one binary - no libraries needed)
Download for Win32: http://users.ugent.be/~bpuype/wget/ (http://users.ugent.be/~bpuype/wget/)
thanks to Bart Puype for the wget build ;-)
When the main server shuts down due to a UPS Command, the script is called by the UPS Software during shutdown.
Cheers,
AndyB
Just copy the following lines to notepad and save as nas_shutdown.bat
@echo off
rem --- D-Link DNS-323 Shutdown Script
rem --- created by Andreas Baumgärtner
rem --- version 1.0
rem --- 20090930
rem --- Info:
rem --- don't change the uname!!
rem --- change passwd and ip to your needs
rem --- timeout is in seconds adjust it to your needs - for me 5 seconds where enough
rem --- only one try otherwise the script could delay the shutdown for too long
echo Shutting down NAS_002 ...
set UNAME=admin
set PASSWD=yourpassword
set IP=172.17.0.6
wget --tries=1 --timeout=5 "http://%IP%/goform/formLogin?f_login_type=0&f_LOGIN_NAME=%UNAME%&f_LOGIN_PASSWD=%PASSWD%"
IF %ERRORLEVEL%==0 (
wget --tries=1 --timeout=5 "http://%IP%/goform/sysShutDown?shootdown"
) ELSE (
echo Unable to shutdown NAS_002
)
echo Shutting down NAS_001 ...
set UNAME=admin
set PASSWD=yourpassword2
set IP=172.17.0.5
wget --tries=1 --timeout=5 "http://%IP%/goform/formLogin?f_login_type=0&f_LOGIN_NAME=%UNAME%&f_LOGIN_PASSWD=%PASSWD%"
IF %ERRORLEVEL%==0 (
wget --tries=1 --timeout=5 "http://%IP%/goform/sysShutDown?shootdown"
) ELSE (
echo Unable to shutdown NAS_001
)
SET IP=
SET PASSWD=
SET UNAME=
-
Linux script:
#!/bin/sh
#
# --- D-Link DNS-323 Shutdown Script
# --- created by Andreas Baumgärtner
# --- version 1.0
# --- 20090930
#
# --- Info:
# --- don't change the uname!!
# --- change passwd and ip to your needs
# --- timeout is in seconds adjust it to your needs - for me 5 seconds where enough
# --- only one try otherwise the script could delay the shutdown for too long
echo Shutting down DS-323 ...
UNAME=admin
PASSWD=password
IP=172.10.34.223
echo "http://$IP/goform/formLogin?f_login_type=0&f_LOGIN_NAME=$UNAME&f_LOGIN_PASSWD=$PASSWD"
wget --tries=1 --timeout=5 "http://$IP/goform/formLogin?f_login_type=0&f_LOGIN_NAME=$UNAME&f_LOGIN_PASSWD=$PASSWD"
if [ $? -eq 0 ]
then
echo "http://$IP/goform/sysShutDown?shutdown"
wget --tries=1 --timeout=5 "http://$IP/goform/sysShutDown?shutdown"
else
echo Unable to shutdown NAS_002
fi
IP=
PASSWD=
UNAME=
-
hi,
there are any possibility to adapt this script to dns320l?
i tried without success.
allways get error in 'wget' login.
"
Connecting to 192.168.1.99:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2016-07-05 19:58:00 ERROR 404: Not Found.
errorlevel="8"
"
thank you.