Automatically hibernates the ubuntu laptop when the battery charge is less than or equal to 8%.
----Pre-requisites----
- A swap partition with size more than that of RAM of the system.
- A user account with sudo privileges.
----Procedure----
- sudo apt-get install acpi
- Run "cat /etc/fstab" or "sudo blkid" and copy the UUID of swap partition.
- sudo gedit /etc/default/grub
- Go to and paste UUID on the given line, "GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=<UUID of swap partition>""
- sudo update-grub
- Reboot the system.
- chmod a+x AutoHibernate.py
- sudo gedit /etc/systemd/system/AutoHibernate.service
- Copy paste the contents of "AutoHibernate.service" file. Be sure to modify the lines 5 and 7.
- sudo systemctl daemon-reload
- sudo systemctl start AutoHibernate
- sudo systemctl enable AutoHibernate