NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

Forum Discussion

pjhunter's avatar
pjhunter
Aspirant
Aug 17, 2020
Solved

RN312 - programatically eject external USB storage and programatically shutdown RN312.

I am faced with unexpected power outages (here in CA). My RN312 is on a UPS, but sometimes the outage lasts longer than the UPS battery. I monitor the battery state on a separage windows system that I can use to SSH into the RN312. After on battery power for 10 minutes, I need to start an orderly shutdown of various devices, including my RN312.  The RN312 has an external USB disk attached to it, and if it is not ejected before power is lost to the RN312, it becomes corrupted and has to be reformatted.

 

What I am looking for is 2 script commands to (1)to safely eject the attached USB drive, and (2)to perform an orderly shutdown of the RN312.   I've tried umount /dev/sdc2 but I am not convinced it does what I need.  I also don't know the script command to shutdown the RN312.

 

Thanks.

 

  • Thanks StephenB ,

    This your suggestion would work (letting NAS monitor the UPS), but shutting down the PC's manually wouldn't work, if nobody is around (which is often the case).

     

    The solution you referred to in the older post "rnutil rn_shutdown" works perfectly.  I tested it and the USB external drive was properly shutdown followed by the NAS itself.

     

    The PC monitoring the UPS now has an script that fires after 10 minutes on battery that, among other things, sends an ssh command the RN312:

    ssh root@nas -command rnutil rn_shutdown

     

    Perfect solution. Thanks.

     

3 Replies

Replies have been turned off for this discussion
  • StephenB's avatar
    StephenB
    Guru - Experienced User

    Generally its best to have the RN312 monitor the UPS over USB.  Windows PCs and Macs that don't use RAID are less likely to be adversely affected by an unclean shutdown.  So I'd switch to having the ReadyNAS monitor the UPS, and shut down the PCs manually.  There's less risk (and it will work even if you are not home).

     

    But to your question: the info in this old post should work:  https://community.netgear.com/t5/New-ReadyNAS-Users-General/How-to-shutdown-my-ReadyNAS-Pro-4-RNDP4000-OS6-10-0/m-p/1748742#M36569 One mistake in that post:  you should use root (and not admin).

     

    The shutdown should also eject the USB drive (though that is not something I've tested, as I don't connect USB drives to my NAS).

     

     

    • pjhunter's avatar
      pjhunter
      Aspirant

      Thanks StephenB ,

      This your suggestion would work (letting NAS monitor the UPS), but shutting down the PC's manually wouldn't work, if nobody is around (which is often the case).

       

      The solution you referred to in the older post "rnutil rn_shutdown" works perfectly.  I tested it and the USB external drive was properly shutdown followed by the NAS itself.

       

      The PC monitoring the UPS now has an script that fires after 10 minutes on battery that, among other things, sends an ssh command the RN312:

      ssh root@nas -command rnutil rn_shutdown

       

      Perfect solution. Thanks.

       

      • StephenB's avatar
        StephenB
        Guru - Experienced User

        pjhunter wrote:

        This your suggestion would work (letting NAS monitor the UPS), but shutting down the PC's manually wouldn't work, if nobody is around (which is often the case).

         


        Correct.  If the UPS battery drains, the PCs would do an unclean shutdown.  In my experience, that isn't a problem.  Though I don't tend to leave documents open, etc. on my PCs.

         


        pjhunter wrote:

         

        The PC monitoring the UPS now has an script that fires after 10 minutes on battery that, among other things, sends an ssh command the RN312:

        ssh root@nas -command rnutil rn_shutdown

         

        Perfect solution. Thanks.

         


        Glad I could help.

NETGEAR Academy

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

Join Us!

ProSupport for Business

Comprehensive support plans for maximum network uptime and business peace of mind.

 

Learn More