Readme.md aktualisiert

This commit is contained in:
Manuel Kamper 2023-12-28 17:39:51 +00:00
parent c5425aa9db
commit 7f9fb257c9

View File

@ -11,11 +11,11 @@ To receive notifications when your disk space on your Ubuntu server is running l
Install the mailutils package if its not already installed on your server:
´sudo apt-get install mailutils´
´´´sudo apt-get install mailutils´´´
Create a script to send an email notification when disk space is low:
Create a script to send an email notification when disk space is low:
Copy code
´´´
#!/bin/bash
# Set your email address here
@ -32,20 +32,19 @@ df -h / | awk '$NF > "{{threshold}}%" {print $1}' | while read disk; do
echo "Disk $disk is full!" | mail -s "Disk Full Alert" "$email"
fi
done
´´´
Save the script as disk_full_alert.sh and make it executable:
Save the script as disk_full_alert.sh and make it executable:
Copy code
chmod +x disk_full_alert.sh
´´´chmod +x disk_full_alert.sh´´´
Set up a cron job to run the script daily:
Set up a cron job to run the script daily:
Copy code
sudo crontab -e
Add the following line to the crontab file:
´´´sudo crontab -e´´´
Copy code
0 0 * * * /path/to/disk_full_alert.sh
This will run the script at midnight every day.
Add the following line to the crontab file:
´´´0 0 * * * /path/to/disk_full_alert.sh´´´
This will run the script at midnight every day.
Now, you should receive an email notification when the disk space on your server is running low. You can adjust the threshold variable in the script to set the disk usage percentage at which you want to receive notifications.