Wake up your nas with php and etherwake
Sometimes you dont want to go to your NAS and power it on, it would be nice if you could use a Raspberry Pi to wake it up. There is a quick and dirty solution with PHP and shell_exec to call etherwake and wake up your NAS.
You’ll need an Raspberry Pi with Raspbian or Debian Wheezy (any other Debian machine will work to) with an installed Webserver and PHP.
First we have to install etherwake
sudo apt-get install etherwake
Now you can create your /var/www/wakeNAS.sh
sudo /usr/sbin/etherwake -i eth0 -b $MAC
Change owner and permission
chown www-data /var/www/wakeNAS.sh
chgrp www-data /var/www/wakeNAS.sh
chmod +x /var/www/wakeNAS.sh
And create a php file with following content
And set sudo permission without password for etherwake and www-data
# Cmnd alias specification
Cmnd_Alias WAKE = /usr/sbin/etherwake
www-data ALL=NOPASSWD: WAKE
Now you can call your php file and your NAS will wake up.
This is only a quick and dirty snippet, you should only use in your local network!