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:
parent
280349cb47
commit
c3b2e00850
5 changed files with 23 additions and 9 deletions
|
@ -3,11 +3,11 @@
|
|||
user: l3d
|
||||
users:
|
||||
l3d:
|
||||
- l3d@backup.l3d.yt
|
||||
- l3d@backup.l3d.yt
|
||||
- l3d@derpy.l3d.yt
|
||||
- l3d@mobile.l3d.yt
|
||||
- l3d@pinkie.l3d.yt
|
||||
- l3d@business.wingcon.com
|
||||
|
||||
admins:
|
||||
- l3d
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
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
|
||||
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
|
||||
zenity --warning --title="Critical Power" --text="$power percent remaining.\n\nPlease recharge NOW!" --display=:0.0
|
||||
elif (( $power < 5 )); then
|
||||
|
|
BIN
roles/akku-warning/files/low_battery.mkv
Normal file
BIN
roles/akku-warning/files/low_battery.mkv
Normal file
Binary file not shown.
|
@ -9,10 +9,21 @@
|
|||
group: 'root'
|
||||
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
|
||||
package:
|
||||
name: zenity
|
||||
name:
|
||||
- zenity
|
||||
- mpv
|
||||
state: present
|
||||
|
||||
- name: Check akku every 2 minutes
|
||||
|
@ -20,17 +31,17 @@
|
|||
cron:
|
||||
name: check if akku still okay
|
||||
job: /opt/akku.sh
|
||||
minute: '*/2'
|
||||
minute: '*/3'
|
||||
user: '{{ user }}'
|
||||
cron_file: /etc/crontab
|
||||
|
||||
- name: Make sure cron is installed
|
||||
become: true
|
||||
when: install_and_enable_cronie
|
||||
packages:
|
||||
names:
|
||||
package:
|
||||
name:
|
||||
- cronie
|
||||
state: latest
|
||||
state: present
|
||||
|
||||
- name: Make sure cron is running
|
||||
become: true
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 2fbb751274de7142bfd900acb85c9176e2635505
|
||||
Subproject commit c48af1bfce7fba97a117cdfe83ee9763e6ad88ac
|
Loading…
Reference in a new issue