Difference between revisions of "HDA As Part Time Server"

From Amahi Wiki
Jump to: navigation, search
Line 24: Line 24:
 
  54 8 * * 6 root usr/sbin/etherwake XX:XX:XX:XX:XX:XX
 
  54 8 * * 6 root usr/sbin/etherwake XX:XX:XX:XX:XX:XX
  
:5. Save and exit the nano editor, the close the SSH session.
+
:5. Save and exit the nano editor, the close the ReadyNAS SSH session.
  
 
:6. Next on the HDA, [[Open_Terminal_as_root|open a terminal as root user]]:
 
:6. Next on the HDA, [[Open_Terminal_as_root|open a terminal as root user]]:

Revision as of 17:21, 25 April 2015

Warning.png WARNING
This is recommended only for Advanced users, proceed with caution.


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

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

This use case involves an HDA "woken up" each Saturday to receive a backup from a 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. Details can be found at etherwake manpages site.
apt-get update
apt-get install etherwake
3. Setup the WOL script in the /etc/cron.d folder on the ReadyNAS, which runs the script at the time you want. So continuing in the same SSH session, and using nano as the editor to create the script wake-HP-NAS. In my case I have an HP Mediasmart, thus the name:
cd /etc/cron.d
sudo nano wake-HP-NAS
4. Add the line detail you need within nano editor: For me, where XX...XX is the Mac ID, this wakes up the Amahi unit by the ReadyNAS at 8:54 every Saturday. See the man page linked above for all the timing details:
54 8 * * 6 root usr/sbin/etherwake XX:XX:XX:XX:XX:XX
5. Save and exit the nano editor, the 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. In my case by telling the HDA to turn off every Sat at 5pm:
0 17 * * 6 root /sbin/shutdown -h 0
8. Save and exit.

Then you'll need to set backups to run. On the ReadyNAS it is easy. Just fill out 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. Hopefully this helps some of you.