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

Update akku warning script

This commit is contained in:
L3D 2019-04-07 18:33:12 +02:00
parent 280349cb47
commit c3b2e00850
5 changed files with 23 additions and 9 deletions

View file

@ -3,11 +3,11 @@
user: l3d user: l3d
users: users:
l3d: l3d:
- l3d@backup.l3d.yt
- l3d@backup.l3d.yt - l3d@backup.l3d.yt
- l3d@derpy.l3d.yt - l3d@derpy.l3d.yt
- l3d@mobile.l3d.yt - l3d@mobile.l3d.yt
- l3d@pinkie.l3d.yt - l3d@pinkie.l3d.yt
- l3d@business.wingcon.com
admins: admins:
- l3d - l3d

View file

@ -2,8 +2,11 @@
power="$((`cat /sys/class/power_supply/BAT0/energy_now` * 100 / `cat /sys/class/power_supply/BAT0/energy_full_design`))" 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 if (( $power < 25 && $power > 15 )); then
zenity --warning --title="Low Power" --text="$power percent remaining.\n\nPlease recharge soon!" --display=:0.0 zenity --warning --title="Low Power" --text="$power percent remaining.\n\nPlease recharge soon!" --display=:0.0
elif (( $power < 15 && $power > 9 )); then
zenity --warning --title="Low Power" --text="$power percent remaining.\n\nPlease recharge soon!" --display=:0.0
mpv /opt/low_battery.mkv -fs --volume 130 --start 00:00:18
elif (( $power < 9 && $power > 5 )); then elif (( $power < 9 && $power > 5 )); then
zenity --warning --title="Critical Power" --text="$power percent remaining.\n\nPlease recharge NOW!" --display=:0.0 zenity --warning --title="Critical Power" --text="$power percent remaining.\n\nPlease recharge NOW!" --display=:0.0
elif (( $power < 5 )); then elif (( $power < 5 )); then

Binary file not shown.

View file

@ -9,10 +9,21 @@
group: 'root' group: 'root'
mode: '0755' mode: '0755'
- name: install zenity - name: copy sound warning video
become: yes
copy:
src: 'files/low_battery.mkv'
dest: '/opt/low_battery.mkv'
owner: 'root'
group: 'root'
mode: '0644'
- name: install zenity and mpv for notifications
become: yes become: yes
package: package:
name: zenity name:
- zenity
- mpv
state: present state: present
- name: Check akku every 2 minutes - name: Check akku every 2 minutes
@ -20,17 +31,17 @@
cron: cron:
name: check if akku still okay name: check if akku still okay
job: /opt/akku.sh job: /opt/akku.sh
minute: '*/2' minute: '*/3'
user: '{{ user }}' user: '{{ user }}'
cron_file: /etc/crontab cron_file: /etc/crontab
- name: Make sure cron is installed - name: Make sure cron is installed
become: true become: true
when: install_and_enable_cronie when: install_and_enable_cronie
packages: package:
names: name:
- cronie - cronie
state: latest state: present
- name: Make sure cron is running - name: Make sure cron is running
become: true become: true

@ -1 +1 @@
Subproject commit 2fbb751274de7142bfd900acb85c9176e2635505 Subproject commit c48af1bfce7fba97a117cdfe83ee9763e6ad88ac