Wake up diskstation

I am using a Synology DS216play NAS which is a perfect solution to store 8 to 16 Gig of pictures. To save energy, the NAS is shut down after 20 minutes of inactivity and woken up by WOL. Broadcasting a magic packet doesn’t seem work on my router but directly addressing the network card is working (the MAC address can be found on the label on the rear).
Wake up can be done by numerous ways, by a standalone program, Applescript/Python, shell/autofs while I finally used the homebrew approach of trick77.

#brew install wakeonlan

#!/bin/sh
. /etc/rc.common
CheckForNetwork
while [ "${NETWORKUP}" != "-YES-" ]
do
        sleep 1
        NETWORKUP=
        CheckForNetwork
done
wakeonlan -i 192.168.170.122 00:08:9B:C5:BD:21 #<-- enter IP and NAS MAC address here

Just for the records, there is also a solution to shut the station down remotely (at the price of a big security hole)

#https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb

#!/bin/sh
sshpass -p 'password' ssh root@192.168.170.122 shutdown -h now  #<-- enter password and IP here