This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Putty/plink script to use SSH to connect to my Sophos Home UTM to shutdown the UTM?

I am working on a project to use Powershell, Putty and Plink (which are new to me), and CyberPower PowerPanel Business edition that would enable a local PC to monitor the CyberPower UPS battery level and to shutdown the Sophos Home UTM 9.407-3 when the UPS battery level reaches a critical threshold.

The only thing I'm not sure of is whether the Putty command to shutdown the UTM is correct, and that requires knowledge of Putty, Plink, and the Sophos UTM command line syntax.

The Powershell command is "plink.exe -ssh -batch loginuser@192.168.xxx.xxx -pw xxxxxxxx /sbin/shutdown -h now", where xx's are the specific IP address of the UTM and the loginuser password.

Can anyone tell me if this is correct?  If not, what would be the correct command?  

Thank you



This thread was automatically locked due to age.
  • I understand that this is primarily a learning exercise, but I would recommend against actually keeping this in place.  If you shut down the UTM, you will need to physically go to it to restart it if you have no other way to reach the PC that sends commands.  If you let it simply die when there's no more juice, then it will restart as soon as power is restored.  Unlike a server, the odds of anything causing a problem is so small that it is, for all intents and purposes, essentially zero.

    Cheers - Bob

     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA
  • Thank you for the thoughtful reply.  

    The BIOS of the UTM PC was originally set to not auto-power On with AC, but I changed that last week to auto-power On with AC.  That should solve some of the issues that I have seen.

    I have two concerns behind this project:

    1. When power comes back on, it usually flickers, and goes on and off several times in short succession.  I am concerned that the power cycling will create a problem in either the hardware or the UTM software, and may cause the UTM PC to stay powered off.  By conserving the UPS battery, I can avoid some of that.  I also plan to program the UPS to not provide power until a minimum battery charge threshold is met.

    2. I am concerned that a sudden, power-loss driven shutdown of the UTM will cause a software problem that will prevent a reboot or that will cause the UTM to not properly work.  Through your post, are you indicating that this is not so?

    Thank you

  • 1. If the UTM PC is connected to a UPS, that should be enough "ballast" to prevent electrical damage to the PC.  You idea of handling the battery by programming the UPS seem like a better approach than shutting down the PC.

    2. Linux is a lot more robust than Windows.  In the unlikely event that a file is damaged, the OS will repair the file before completing the boot process.

    In fewer that one-in-a-thousand Up2Dates, something will go wrong, requiring a restore of the configuration from the backup made prior to the Up2Date.  Sometimes that won't do it and another reboot solves the problem.  Sometimes, that won't do it and the PostgreSQL databases have to be rebuilt, causing the loss of historical Reporting data and graphs.  Sometimes, that doesn't do it and a complete re-image of the system is required, causing the loss of logs in addition to reporting and graph data.  I've never heard of a UTM having problems because of a power outage.

    Cheers - Bob

     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA
  • Much appreciated.  Not using Putty would certainly be simpler.  I'll try your advice and just go with Auto-on upon AC on the UTM PC, plus some battery management triggers and scripts in the CyberPower PowerPlan software to control the UPS.  Thank you:)