#!/bin/sh # If space on temporary filesystem is full, compact the big files maxpct=80 # Check for space used on tmpfs > maxpct pctused=$(df -h \ | grep tmpfs | cut --delim="." --fields=3 \ | cut --delim="%" --fields=1 | cut --delim=M --fields=2) echo $pctused if test -z $pctused then pctused=1 fi date >> /var/log/checkspace.log if test $pctused -gt $maxpct then echo $pctused"% exceeded"\ $maxpct"% of tmpfs used, forcing logrotate." >> /var/log/checkspace.log /usr/sbin/logrotate --force /etc/logrotate.conf else echo $pctused" lt" $maxpct >> /var/log/checkspace.log fi