-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiskSpaceMonitor.sh
More file actions
29 lines (21 loc) · 831 Bytes
/
diskSpaceMonitor.sh
File metadata and controls
29 lines (21 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# script that will send an email to EMAIL when disk use in partition PART is bigger than %MAX
# Sends email to recipients. Recommend a warning level and then an error level.
##########
MAX=95
EMAIL=someone@where.com,some@where2.com
SERVER=some.server.com
##########
USE=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
if [ $USE -gt $MAX ]; then
printf "ERROR: $SERVER - Disk percent used: $USE\r\n - stop working on the site!\n\n " | mail -s "Running out of disk space" $EMAIL
fi
##########
MAX=81
EMAIL=someone.maker@where.com
SERVER=some.server.com
##########
USE=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
if [ $USE -gt $MAX ]; then
printf "WARNING: Server - $SERVER - Disk percent used: $USE\r\n - Need to clear some space for backups!\n\n " | mail -s "Running out of disk space" $EMAIL
fi