From 9ff455d0dddcb385bf12046da2be809c2f3d14d9 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 24 Jul 2013 11:13:28 +0200 Subject: [PATCH] Adding sample logrotation config and cron This will allow pool operators to rotate the logfiles automatically via cron. --- .gitignore | 1 + cronjobs/etc/logrotate.conf | 6 ++++++ cronjobs/logrotate.sh | 11 +++++++++++ 3 files changed, 18 insertions(+) create mode 100644 cronjobs/etc/logrotate.conf create mode 100755 cronjobs/logrotate.sh diff --git a/.gitignore b/.gitignore index a8f1b1ef..788a1bd7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /public/include/config/global.inc.php /public/templates/compile/*.php /cronjobs/logs/*.txt +/cronjobs/logs/*.txt.*.gz /public/templates/cache/*.php diff --git a/cronjobs/etc/logrotate.conf b/cronjobs/etc/logrotate.conf new file mode 100644 index 00000000..341b89e7 --- /dev/null +++ b/cronjobs/etc/logrotate.conf @@ -0,0 +1,6 @@ +"./logs/*.txt" { + copytruncate + rotate 7 + compress + daily +} diff --git a/cronjobs/logrotate.sh b/cronjobs/logrotate.sh new file mode 100755 index 00000000..78f901ff --- /dev/null +++ b/cronjobs/logrotate.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Find scripts path +if [[ -L $0 ]]; then + CRONHOME=$( dirname $( readlink $0 ) ) +else + CRONHOME=$( dirname $0 ) +fi + +cd $CRONHOME +logrotate etc/logrotate.conf