Family killed by Ninjas – Need money for Karate lessons
Warnung bei voller Partition
Auf einem Server, den ich administriere, läuft in regelmäßigen Abständen die Partition /var voll. Um daraus resultierende Fehler zu vermeiden, habe ich ein kleines Bash-Script geschrieben, dass eine entsprechende Warnung an mich mailt:
#!/bin/bash # # Setting limits softlimit=90 hardlimit=95 # # Retrieves line with information about /var data=$(df -h | grep '/var') # # Reads the percentage of file system usage from the data above percentage=$(echo $data | awk '{ print $5 }') # # Removes the percentage symbol count=$(echo $percentage | sed 's/%//') if [ "$count" -gt "$softlimit" ] then if [ "$count" -le "$hardlimit" ] then echo -n "Warning: File system at $count% capacity!\n Softlimit: $softlimit\n Hardlimit: $hardlimit" | mail -s "Warning: File system at $count% capacity!" user@email fi fi exit #?
| Artikel drucken | Dieser Beitrag wurde von shiruba am September 1, 2008 um 5:33 pm veröffentlicht und unter Entwicklung abgelegt. Du kannst allen Antworten zu diesem Beitrag durch RSS 2.0 folgen. Du kannst eine Antwort schreiben oder einen Trackback von deiner eigenen Seite hinterlassen. |




