Created
July 25, 2021 23:25
-
-
Save prhomhyse/0ecf96820003aecd6484ed28d9b963a5 to your computer and use it in GitHub Desktop.
Revisions
-
prhomhyse created this gist
Jul 25, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ #!/bin/bash LOG="/var/log/cache-clean.log" #Check if the /run directory size is above 100MB run_size=`du -sh /run | awk '{print $1}' | grep -Eo '[0-9]{3}'` if [[ $run_size -gt 100 ]]; then rm -rf /run/nginx-cache/* #Add timestamp to the log echo "$(date +'%F %T')" >> $LOG fi