NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
Hombibi
Sep 05, 2015Guide
How to send a shutdown command to readynas after backup complete.
After a (succesfull) recovery when two HDD's broke down at the same moment I am reconsidering my backup strategy. I have a 6 bay Readnas Pro, running OS6, volumes setup JBOD, as my main NAS, and a ...
- Sep 07, 2015
I haven't used an NV for a long time, but the x86 OS 4.2.x and OS6 all delay a power-off when a backup is in progress, and I suspect OS 4.1.x on an NV will as well. That's how I do my backups. The backup system powers up and initiates the backup. The power off time is scheduled for 15 minutes after power-on, but the unit stays on until the backup is complete if it takes longer than that. Note that power down is also delayed for any scheduled maintenance activities (disk scrupping and file consistenacy checks).
StephenB
Sep 05, 2015Guru - Experienced User
I don't think throughput changes if you change from "push" to "pull". The source server (e.g. the Pro) is doing the sync computations in either case. I use "pull" backup everywhere.
I also use the NV+ for backup, and my approach is simply to have spindown enabled on the NV+. At least half the power use of the NV+ is disk related. So you could set things up so the disks will spin down shortly after backup completes, and the NV+ shutdown remains conservatively set at the 3 hour mark.
Though you can send a shutdown command to the NV+. You install curl on the pro. There are some commands posted here: https://gist.github.com/denwilliams/9701993 (not sure if they work). There's some older documention that was on the Readynas forum but it isn't easily searchable here. One challenge is that if you have multiple backup jobs you want to make sure they have all completed.
Hombibi
Sep 05, 2015Guide
Thanks Stephen, made some progress on the remote shutdown call after your message:
First the curl option:
curl -d "PAGE=System&OUTER_TAB=tab_shutdown&INNER_TAB=NONE&shutdown_option1=1&command=poweroff&OPERATION=set" -k -u admin:<password> https://<IP Backup Machine/get_handler
This works fine to shut down the NV+, but it is the wrong shut down command. Using this will prevent the NV+ to be started with the powertimer.
However searching on I found that the shutdown string used by the powertimer is:
/frontview/bin/autopoweroff &> /dev/null
which I can call remote using SSH:
ssh root@NV+ 'bash -s' < ./Local Script on the Pro to be executed on the NV+.sh
This works from my desktop, so it should work from the Pro, but I need to get around the password, maybe something with exchanging keys?. Next is to detect when the backup queue has finished, which is a cron job, and use that to trigger the remote shutdown.
Anyone ideas/suggestions?
- SandsharkSep 07, 2015Sensei - Experienced User
I haven't used an NV for a long time, but the x86 OS 4.2.x and OS6 all delay a power-off when a backup is in progress, and I suspect OS 4.1.x on an NV will as well. That's how I do my backups. The backup system powers up and initiates the backup. The power off time is scheduled for 15 minutes after power-on, but the unit stays on until the backup is complete if it takes longer than that. Note that power down is also delayed for any scheduled maintenance activities (disk scrupping and file consistenacy checks).
- vandermerweSep 08, 2015Master
Sandshark wrote:
I haven't used an NV for a long time, but the x86 OS 4.2.x and OS6 all delay a power-off when a backup is in progress, and I suspect OS 4.1.x on an NV will as well. That's how I do my backups. The backup system powers up and initiates the backup. The power off time is scheduled for 15 minutes after power-on, but the unit stays on until the backup is complete if it takes longer than that. Note that power down is also delayed for any scheduled maintenance activities (disk scrupping and file consistenacy checks).
Yes 4.1.x does delay scheduled power off for queued backup tasks. You want to ensure of course that the backup jobs are all scheduled to start before the power down time so they are queued. Just schedule them all at the same time.
- HombibiSep 08, 2015Guide
Sandshark, thanks, that sounds like the best and easiest solution.
In the mean time I have gone the hard way writing a script that runs every 10 minutes (cron.d) on the Pro:
first it checks in /etc/frontview/backup_jobs.conf which backup jobs are created and are actif,
Than it checks if the corresponding backup status files in /var/log/frontview/backup/ are created/modified today. (do i still need this?)
Subsequently, it checks if the status in all relevant backupfiles is completed ok.
If so than the script remotely executes a local bash script on the NV+ which shuts it down in the same way the timer does.
Pffff, the clearly the hard way. It works fine now, but yours is much simpler, I'll test that.
For anyone interested the rudimentary scripts, everything runs on the Pro:
Main script
#!/bin/bash logger Backupcheck_started partstatfilestring=/var/log/frontview/backup/status_backup_ arjobnr=($(grep -B 3 "<enabled>1</enabled>" /etc/frontview/backup_jobs.conf | grep "<job_id>" | cut -c 13-15)) for jobnr in "${arjobnr[@]}"; do jobstatusfile="${partstatfilestring}${jobnr}" if [[ $(date +%D -r "${jobstatusfile}") == $(date +%D) ]]; then grep -q '^BACKUP_STATUS__COMPLETED!![0-9]*!!OK$' "${jobstatusfile}" if [[ $? -eq 0 ]]; then grep "SHUTTING_DOWN_NV+" "${jobstatusfile}" if [[ $? -ne 0 ]]; then ((bkpjobscomplete++)) fi fi fi done if [[ "${bkpjobscomplete}" = "${#arjobnr[@]}" ]]; then logger All backup jobs completed, starting shutdown NV+. for jobnr in "${arjobnr[@]}"; do jobstatusfile="${partstatfilestring}${jobnr}" echo "SHUTTING_DOWN_NV+" >> "${jobstatusfile}" ssh root@biliton 'bash -s' < /root/shutdownNV.sh done else logger Backup not started or not completed, shutdown NV+ postponed. fi exit 0
and the local remote shutdown script.
Local remote shutdown script.
#!/bin/bash /frontview/bin/autopoweroff &> /dev/null exit 0
Now that I have shared this I'll test Sanshark's approach.
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!