mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 23:08:06 +02:00
Added disc-space-checker
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=checking disc space
|
||||
OnFailure=systemd-email@%n.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/bash {{disc_space_check_folder}}disc-space-check.sh
|
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
errors=0
|
||||
echo "checking disc space use..."
|
||||
df
|
||||
for disc_use_percent in $(df --output=pcent | sed 1d)
|
||||
do
|
||||
disc_use_percent_number=$(echo "$disc_use_percent" | sed "s/%//")
|
||||
if [ "$disc_use_percent_number" -gt "{{size_percent_disc_space_warning}}" ]; then
|
||||
echo "WARNING: $disc_use_percent_number exceeds the limit of {{size_percent_disc_space_warning}}%."
|
||||
errors+=1;
|
||||
fi
|
||||
done
|
||||
exit $errors;
|
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=starts disc-space-check.service
|
||||
|
||||
[Timer]
|
||||
OnCalendar={{on_calendar_disc_space_check}}
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
Reference in New Issue
Block a user