dev/provisioning/modules/puppi/templates/puppi_clean.erb
author ymh <ymh.work@gmail.com>
Fri, 03 Feb 2017 13:01:08 +0100
changeset 495 c71923e6fa2f
parent 28 b0b56e0f8c7f
permissions -rwxr-xr-x
Correct error when transitioning between thematiques tabs and others (bug #0025983) + correct scroll for themes

#!/bin/bash
# This scripts cleans puppi log files older than <%= scope.lookupvar('puppi::logs_retention_days') %> days
seconds=$(( (RANDOM%60+1)*60 ))
sleep $seconds

if [ "<%= scope.lookupvar('puppi::params::logdir') %>" == "/" ] || [ "x<%= scope.lookupvar('puppi::params::logdir') %>" == "x" ]; then
  exit 1
fi
find "<%= scope.lookupvar('puppi::params::logdir') %>" -type f -mtime +<%= scope.lookupvar('puppi::logs_retention_days') %> -exec rm '{}' '+' >/dev/null 2>&1
find "<%= scope.lookupvar('puppi::params::logdir') %>" -mindepth 2 -type d -mtime +<%= scope.lookupvar('puppi::logs_retention_days') %> -exec rmdir '{}' '+' >/dev/null 2>&1