[Pkg-awstats-commits] [SCM] awstats Debian packaging branch, master, updated. debian/7.0_dfsg-6-3-g67b8b6a
Daniel Pocock
daniel at pocock.com.au
Tue May 22 08:08:27 UTC 2012
The following commit has been merged in the master branch:
commit 67b8b6a945861075a8a56054e4e8fbfaf414bb73
Author: Daniel Pocock <daniel at pocock.com.au>
Date: Tue May 22 10:08:21 2012 +0200
Improve script for post-rotation log scanning
diff --git a/debian/post-logrotate.sh b/debian/post-logrotate.sh
index bedd683..8eca8df 100755
--- a/debian/post-logrotate.sh
+++ b/debian/post-logrotate.sh
@@ -18,12 +18,25 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# NOTES:
+#
+# * Script should typically be called as a postrotate action
+# from logrotate
+#
+# * Use the nosharedscripts setting in logrotate config
+#
+# * The script only acts on files that have a name like access.log.1
+# and silently ignores other filenames (like error.log.1) in
+# case they are passed by mistake. This can be tuned with the
+# ACCESS_LOG parameter below
set -e
DEFAULT=/etc/default/awstats
AWSTATS=/usr/lib/cgi-bin/awstats.pl
ERRFILE=`mktemp --tmpdir awstats.XXXXXXXXXX`
+ACCESS_LOG=access.log
trap 'rm -f $ERRFILE' INT QUIT TERM EXIT
@@ -54,9 +67,8 @@ fi
VHOST=`echo $VHOST_LOG | cut -d/ -f5`
FNAME=`echo $VHOST_LOG | cut -d/ -f6`
-if [ "$FNAME" != access.log.1 ];
+if [ "$FNAME" != ${ACCESS_LOG}.1 ];
then
- echo "Unexpected filename passed to $0: $1"
exit 0
fi
@@ -73,7 +85,7 @@ echo "$AWSTATS_CONF"
if ! nice -n $AWSTATS_NICE \
${AWSTATS} \
-config=${VHOST} \
- -LogFile=${FNAME} \
+ -LogFile=${VHOST_LOG} \
-update \
>$ERRFILE 2>&1
then
--
awstats Debian packaging
More information about the Pkg-awstats-commits
mailing list