1
0
Fork 0
mirror of https://github.com/DO1JLR/ansible_linux_desktop_setup.git synced 2024-09-14 19:54:51 +02:00

Add akku warning script

This commit is contained in:
L3D 2019-03-11 20:22:44 +01:00
parent 53a09af828
commit f5f657f702
3 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1,11 @@
#!/bin/bash
power="$((`cat /sys/class/power_supply/BAT0/energy_now` * 100 / `cat /sys/class/power_supply/BAT0/energy_full_design`))"
if (( $power < 15 && $power > 9 )); then
zenity --warning --title="Low Power" --text="$power percent remaining.\n\nPlease recharge soon!" --display=:0.0
elif (( $power < 9 && $power > 5 )); then
zenity --warning --title="Critical Power" --text="$power percent remaining.\n\nPlease recharge NOW!" --display=:0.0
elif (( $power < 5 )); then
zenity --warning --title="Critical Power" --text="$power percent remaining.\n\nRECHARGE!\nNOW!" --display=:0.0
fi

View file

@ -0,0 +1,26 @@
---
- name: copy sound warning script
become: yes
copy:
src: 'files/akku.sh'
dest: '/opt/akku.sh'
owner: 'root'
group: 'root'
mode: '0755'
- name: install zenity
become: yes
package:
name: zenity
state: present
- name: Check akku every 2 minutes
become: yes
cron:
name: check if akku still okay
job: /opt/akku.sh
minute: '*/2'
user: root
cron_file: /etc/crontab

View file

@ -26,6 +26,15 @@
roles: roles:
- dotfiles - dotfiles
- name: set akku warning
hosts: thinkpad
tags:
- setup
- akku
roles:
- akku-warning
- name: install modules for sound and bluetooth - name: install modules for sound and bluetooth
hosts: thinkpad hosts: thinkpad
tags: tags: