Skip to content

Auto shutdown linux pc when disconnected to internet (Power outage happened and server powered by ups shutdown itself)

Notifications You must be signed in to change notification settings

sunny420x/auto-shutdown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Auto Shutdown

Auto Shutdown is designed to use in linux machine such as ubuntu and etc with UPS. To automatically shutdown using poweroff command to prevent hardware issues such as Hard drive dead after being instant shutdown due to power outage.

The setup should be...

  • Just PC is connected to UPS.
  • And Router are not connected to UPS.

When power-outage happend the router are just going to down and the machine running this script will not able to ping to the router. Meaning power-outage is happend and itself are currently powered by UPS, So it would need to shutdown while UPS is still supplying the power to prevent hardware issues leads to data lost.

Manual installation by using commands below.

  • 1. cp .service and .timer to /etc/systemd/system/ using command: "cp autoshutdown.service /etc/systemd/system/autoshutdown.service && cp autoshuwdown.timer /etc/systemd/system/autoshuwdown.timer"
  • 2. mv autoshutdown.py to /bin/
  • 3. enable service using command: "sudo systemctl enable autoshutdown"
  • 4. start service using command: "sudo systemctl start auto shutdown"

About

Auto shutdown linux pc when disconnected to internet (Power outage happened and server powered by ups shutdown itself)

Topics

Resources

Stars

Watchers

Forks