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.
- 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"