Difference between revisions of "HDA As Part Time Server"

From Amahi Wiki
Jump to: navigation, search
Line 5: Line 5:
 
message = This is recommended only for ''Advanced'' users, proceed with caution.}}
 
message = This is recommended only for ''Advanced'' users, proceed with caution.}}
 
</center>
 
</center>
 +
:'''NOTE:''' 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|enabling WOL]] guidance.
 +
 
The purpose of this article is to demonstrate how you can use the Amahi HDA as a part time server.
 
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|enabling WOL]] guidance.
+
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.   
 
 
This use case 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. [[Turning_off_DHCP|Turn off DHCP]] on the HDA.
 
:1. [[Turning_off_DHCP|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 [http://manpages.ubuntu.com/manpages/raring/man8/etherwake.8.html etherwake] manpages site.
+
: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 update
 
  apt-get install etherwake
 
  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:
+
::'''NOTE:''' Details can be found at [http://manpages.ubuntu.com/manpages/raring/man8/etherwake.8.html 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
 
  cd /etc/cron.d
 
  sudo nano wake-HP-NAS
 
  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:
+
: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
 
  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.
+
:5. Save and exit the nano editor, then 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]]:
 
  sudo nano /etc/crontab
 
  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:
+
: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
 
  0 17 * * 6 root /sbin/shutdown -h 0
  
:8. Save and exit.   
+
:8. Save and exit, then close the HDA SSH session.   
  
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.
+
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.

Revision as of 17:31, 25 April 2015

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 (Fedora 19). 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.