HDA As Part Time Server

From Amahi Wiki
Jump to: navigation, search
Warning.png WARNING
This is recommended only for Advanced users, proceed with caution.


NOTE: Although this is for Amahi 6 (Ubuntu), it can be adapted for Amahi 7 or greater . This guide assumes you've followed the enabling WOL guidance.

The purpose of this article is to demonstrate how you can use the Amahi HDA as a part time server.

This example involves an HDA "woken up" each Saturday to receive a backup from ReadyNAS. Then the HDA turns itself off later in the day. It works flawlessly for me each week. On some Saturdays, I SSH in and update packages as needed.

1. Turn off DHCP on the HDA.
2. Download etherwake to the ReadyNAS to be able to WOL the HDA. Start an SSH session into the ReadyNAS, update the package list and install etherwake:
apt-get update
apt-get install etherwake
NOTE: Details can be found at etherwake manpages site.
3. Setup the WOL script in the /etc/cron.d folder on the ReadyNAS, which runs the script at the time you want. Use nano as the editor to create the script wake-HP-NAS:
cd /etc/cron.d
sudo nano wake-HP-NAS
4. Add the line detail you need (where XX...XX is the Mac ID, this wakes up the HDA by the ReadyNAS at 8:54 every Saturday):
54 8 * * 6 root usr/sbin/etherwake XX:XX:XX:XX:XX:XX
5. Save and exit the nano editor, then close the ReadyNAS SSH session.
6. Next on the HDA, open a terminal as root user:
sudo nano /etc/crontab
7. Add the line detail you need at the end (example instructs the HDA to turn off every Sat at 5pm):
0 17 * * 6 root /sbin/shutdown -h 0
8. Save and exit, then close the HDA SSH session.

Then you'll need to set backups to run. On the ReadyNAS it is simple; complete the backup script fields in the Web UI and make sure they start after the HDA has had time to boot. Also make sure they have enough time to finish. You may want to do the first backup task before the timers are set up as above, to make sure subsequent incremental backups (shorter time) are done in your time window.