View Single Post
Old 07-05-2008, 12:04 PM   #30
linus1 linus1 is offline
Member
Join Date: May 2007
Experience Points:
5,840, Level: 18
Points: 5,840, Level: 18 Points: 5,840, Level: 18 Points: 5,840, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Thanks: Gave 29, Got 19
Posts: 142
Re: My RAID5 self-build NAS project

mickwall - will add performance details later today hopefully...

tinners - i bodged a script to use on my HTPC to wake my server, dunno if its of use to you/anyone else. it first checks whether the server is online already. if it isnt, it runs the WOL exe. it will then repeat ping the server until its on the network (because it takes a minute for my NAS to get network connectivity so this tells me exactly when its available). the "ping -n 15 0..." command is used only to pause the screen for a few seconds (same as using sleep command but without the need for additional exe files). might be an easier way of doing all this but it works for me

Code:
@echo off


:: Ping the server to determine state  

ping -n 1 200.200.1.111 | find "TTL" > nul

if not %ERRORLEVEL% == 1 goto ACTIVE
goto WAKEUP


::::::::::::::::::::::::
:ACTIVE
::::::::::::::::::::::::
echo.
echo ==========================
echo  SERVER IS ALREADY ACTIVE
echo ==========================
echo.
goto END


:::::::::::::::
:WAKEUP
:::::::::::::::
echo.
echo Server not detected...
echo ======================
echo.
echo Wake up FREENAS server via LAN:
:: note - wolcmd.exe MAC addr - IP of server - subnet
"wolcmd.exe" aabbccddeeffgg 200.200.1.111 255.255.255.0
:: this next lines only purpose is to pause the screen for a few seconds
ping -n 15 0 | find "TTL" > nul

got ONLINE

:::::::::::::::
:ONLINE
:::::::::::::::

:: PING SERVER UNTIL RESPONSE THEN CONTINUE
cls
echo.
echo Waiting for server to come online...
echo ====================================
echo.
ping -n 1 200.200.1.111
if not %ERRORLEVEL% == 1 goto AWAKE
goto ONLINE

:::::::::::::::
:AWAKE
:::::::::::::::
echo.
echo ======================
echo  SERVER IS NOW ACTIVE
echo ======================
echo.
goto END

:::::::::::
:END
:::::::::::

ping -n 15 0 | find "TTL" > nul
  Quote