Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 142467 Details for
Bug 208560
app-admin/sysklogd log rotating cron script with no perl/debianutils dependency
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
/etc/cron.daily/syslog.cron
sysklogd (text/plain), 1.88 KB, created by
Natanael Copa
on 2008-02-02 11:00:41 UTC
(
hide
)
Description:
/etc/cron.daily/syslog.cron
Filename:
MIME Type:
Creator:
Natanael Copa
Created:
2008-02-02 11:00:41 UTC
Size:
1.88 KB
patch
obsolete
>#!/bin/sh ># This is a shell script replacement for the sysklogd's logrotate cron script ># and syslogd-listfiles perl script. ># Copyright (C) 2008 N. Angelacos for the Alpine Linux project - GPL2 > > >CONF="/etc/syslog.conf" > > >syslogd_listfiles() { > # List the target files from syslog.conf > > local skip="auth" > [ "$1" = "--auth" ] && skip=" " > > # the while loop joins lines that end in "\" > # the sed (in order)- > # strips comments; > # collapses spaces/tabs to 1 space; > # deletes the "-" in front of the filename; > # deletes lines that have the "skip" facility > # deletes the facility (leaving just the filename) > # deletes lines that are not filenames with leading "/" > while read a ; do echo "$a"; done < $CONF |\ > sed -n "/^ *#/D; /^[ ]*$/D; s/[ ]\+/ /g; \ > s+ -/+ /+g; /^.*\($skip\)[^ ]* /D; \ > s/^[^ ]* //; /^[^\\/]/D; P" |\ > sort | uniq >} > ># dumb little savelog - no error checking here >savelog () { > local group="adm" > local mode="644" > local user="root" > local cycle=2 > local logfile="" > > # parse args > while getopts "g:u:m:c:" opt; do > case $opt in > g) group=$OPTARG ;; > u) user=$OPTARG ;; > m) mode=$OPTARG ;; > c) cycle=$OPTARG ;; > *) echo "unknown option: $opt" >&2 && return 1;; > esac > done > shift $(( $OPTIND - 1 )) > logfile=$1 > > # Cycle the logs > while [ $cycle -ne 0 ]; do > p=$cycle > cycle=$(( $cycle - 1 )) > a=$logfile.$cycle* > b=$( echo $a | sed "s/\.$cycle/\.$p/") > [ -f $a ] && mv $a $b > done > > # compress .1 and let .0 be uncompressed > [ -f $logfile.1 ] && gzip $logfile.1 > [ -f $logfile ] && mv $logfile $logfile.0 > > # set permissions > chown $user:$group $logfile.* 2>/dev/null > chmod $mode $logfile.* 2>/dev/null >} > > ># Main script > >for LOG in $( syslogd_listfiles ); do > [ -f $LOG ] && savelog -g adm -m 640 -u root -c 7 $LOG >done > >for LOG in $(syslogd_listfiles --auth); do > [ -f $LOG ] && savelog -g adm -m 640 -u root -c 7 $LOG >done > >killall -HUP syslogd >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 208560
: 142467 |
323720