Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

[SSI] openssi/logrotate/test mailer,NONE,1.1.3.1.2.1 test,NONE,1.1.3.1.2.1 : msg#00334

Subject: [SSI] openssi/logrotate/test mailer,NONE,1.1.3.1.2.1 test,NONE,1.1.3.1.2.1 test-config.1.in,NONE,1.1.3.1.2.1 test-config.2.in,NONE,1.1.3.1.2.1 test-config.3.in,NONE,1.1.3.1.2.1 test-config.4.in,NONE,1.1.3.1.2.1 test-config.5.in,NONE,1.1.3.1.2.1 test-config.6.in,NONE,1.1.3.1.2.1 test-config.7.in,NONE,1.1.3.1.2.1 test-config.8.in,NONE,1.1.3.1.2.1 test-config.9.in,NONE,1.1.3.1.2.1
Update of /cvsroot/ssic-linux/openssi/logrotate/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8200/logrotate/test

Added Files:
      Tag: OPENSSI-RH
        mailer test test-config.1.in test-config.2.in test-config.3.in 
        test-config.4.in test-config.5.in test-config.6.in 
        test-config.7.in test-config.8.in test-config.9.in 
Log Message:
Added logrotate package to fix wtmp CDSL not being handled properly.

M openssi/Makefile
M openssi/install
M openssi/upgrade
        Changes to build and install logrotate package.
A openssi/logrotate/*
                 


--- NEW FILE: mailer ---
#!/bin/bash

echo "Args: $*" >> mail-out
echo "---" >> mail-out
cat >> mail-out
echo "---" >> mail-out

--- NEW FILE: test ---
#!/bin/bash

LOGROTATE=../logrotate
M="-m ./mailer"
S=-"s state"
RLR="$LOGROTATE $M $S"

cleanup() {
    rm -f test*.log* anothertest*.log* state test-config.[1-9] scriptout 
mail-out

    [ -n "$1" ] && echo "Running test $1"
    return 0
}

genconfig() {
    input=test-config.$1.in
    output=test-config.$1
    sed "s,&DIR&,$PWD,g" < $input > $output
}

createlog() {
    num=$1
    file=$2
    compressed=$3

    case $num in
        0)
            what=zero
            ;;
        1)
            what=first
            ;;
        2)
            what=second
            ;;
        3)
            what=third
            ;;
        4)
            what=fourth
            ;;
        5)
            what=fifth
            ;;
        6)
            what=sixth
            ;;
        7)
            what=seventh
            ;;
        8)
            what=eight
            ;;
        9)
            what=ninth
            ;;
        *)
            exit 1
            ;;
    esac

    echo $what > $file
    [ -n "$compressed" ] && gzip -9 $file
}

createlogs() {
    base=$1
    numlogs=$2
    compressed=$3

    rm -f ${base}*

    num=0
    while [ $num != $numlogs ]; do
        if [ $num = 0 ]; then
            createlog 0 $base
        else
            createlog $num ${base}.$num $compressed
        fi

        num=`expr $num + 1`
    done
}

checkoutput() {
    while read line; do
        set $line
        file=$1
        compressed=$2
        shift 2

        fileother=`echo $line | awk '{print $1}'`
        expected=`echo $line | cut -s -d\  -f3-`

        if [ $file != $fileother ]; then
            echo "unexpected file $file'" >&2
            exit 2
        fi

        if [ ! -f $file ]; then
            echo "file $file does not exist"
        fi

        if [ -n "$compressed" -a "$compressed" != 0 ]; then
                contents=`zcat $file`
        else
                contents=`cat $file`
        fi
        if [ "$contents" != "$expected" ]; then
            echo "file $file does not contain expected results (compressed 
$compressed, args $*)" >&2
            echo contains: \'$contents\'
            echo expected: \'$expected\'
            exit 2
        fi
    done
}

preptest() {
    base=$1
    confignum=$2
    numlogs=$3
    compressed=$4

    rm -f $base*
    rm -f state

    genconfig $confignum
    createlogs $base $numlogs $compressed
}

# we don't want any stuff left from previous runs
cleanup

# Without a log file, no rotations should occur
preptest test.log 1 2
$RLR test-config.1 

checkoutput test.log* <<EOF
test.log 0 zero
test.log.1 0 first
EOF

# Put in place a state file that will force a rotation
cat > state <<EOF
logrotate state -- version 1
"$PWD/test.log" 2000-1-1
EOF

# Now force the rotation
$RLR test-config.1
checkoutput test.log* <<EOF
test.log 0
test.log.1 0 zero
test.log.2 0 first
EOF

# rerun it to make sure nothing happens
$RLR test-config.1 

checkoutput test.log* <<EOF
test.log
test.log.1 0 zero
test.log.2 0 first
EOF

cleanup 1

preptest test.log 2 3
$RLR test-config.2 --force

checkoutput test.log* <<EOF
test.log.1 0 zero
test.log.2 0 first
EOF

if [ -f test.log ]; then
    echo "erroneously created test.log"
fi

cleanup 2

preptest test.log 3 1
$RLR test-config.3 --force

checkoutput test.log* <<EOF
test.log 0
test.log.1 0 zero
scriptout 0 foo
EOF

cleanup 3

preptest test.log 3 1
preptest test2.log 3 1
$RLR test-config.3 --force

checkoutput test*.log* <<EOF
test.log 0
test.log.1 0 zero
test2.log 0
test2.log.1 0 zero
scriptout 0 foo foo
EOF

cleanup 4

preptest test.log 4 1
preptest test2.log 4 1
$RLR test-config.4 --force 

checkoutput test*.log* <<EOF
test.log 0
test.log.1 0 zero
test2.log 0
test2.log.1 0 zero
scriptout 0 foo
EOF

cleanup 5

preptest test.log 5 1
preptest anothertest.log 5 1
$RLR test-config.5 --force 

checkoutput test*.log* <<EOF
test.log 0
test.log.1 0 zero
anothertest.log 0
anothertest.log.1 0 zero
scriptout 0 foo
EOF

cleanup 6

preptest test.log 6 1
preptest anothertest.log 6 1
$RLR test-config.6 --force

checkoutput test*.log* <<EOF
test.log 0
test.log.0 0 zero
anothertest.log 0
anothertest.log.0 0 zero
scriptout 0 foo
EOF

cleanup 7

preptest test.log 7 1
preptest anothertest.log 7 1
$RLR test-config.7 --force

checkoutput test*.log* <<EOF
test.log 0
test.log.6 0 zero
anothertest.log 0
anothertest.log.6 0 zero
scriptout 0 foo
EOF

cleanup 8

preptest test.log 8 1 1
$RLR test-config.8 --force

checkoutput test*.log* <<EOF
test.log 0
test.log.1.gz 1 zero
scriptout 0 foo
EOF

cleanup 9

preptest test.log 9 1 1
$RLR test-config.9 --force

checkoutput test*.log <<EOF
test.log 0
scriptout 0 foo
EOF

cleanup

--- NEW FILE: test-config.1.in ---
create

&DIR&/test.log {
    daily
    # note the white space after this line
    rotate 2 
    mail user@xxxxxxxxxx
    maillast
}

--- NEW FILE: test-config.2.in ---
"&DIR&/test.log" {
    monthly
    rotate 2
    mail user@xxxxxxxxxx
    maillast
}

--- NEW FILE: test-config.3.in ---
create

&DIR&/test*.log {
    monthly
    rotate 1
    mail user@xxxxxxxxxx
    maillast

    postrotate
        touch scriptout
        echo $(cat scriptout) foo > foo
        mv foo scriptout
    endscript
}

--- NEW FILE: test-config.4.in ---
create

&DIR&/test*.log {
    monthly
    rotate 1
    mail user@xxxxxxxxxx
    maillast
    sharedscripts

    postrotate
        touch scriptout
        echo $(cat scriptout) foo > foo
        mv foo scriptout
    endscript
}

--- NEW FILE: test-config.5.in ---
create

&DIR&/test.log &DIR&/anothertest.log {
    monthly
    rotate 1
    mail user@xxxxxxxxxx
    maillast
    sharedscripts

    postrotate
        touch scriptout
        echo $(cat scriptout) foo > foo
        mv foo scriptout
    endscript
}

--- NEW FILE: test-config.6.in ---
create

&DIR&/test.log &DIR&/anothertest.log {
    monthly
    rotate 1
    start 0
    mail user@xxxxxxxxxx
    maillast
    sharedscripts

    postrotate
        touch scriptout
        echo $(cat scriptout) foo > foo
        mv foo scriptout
    endscript
}

--- NEW FILE: test-config.7.in ---
create

&DIR&/test.log &DIR&/anothertest.log {
    monthly
    rotate 3
    start 6
    mail user@xxxxxxxxxx
    maillast
    sharedscripts

    postrotate
        touch scriptout
        echo $(cat scriptout) foo > foo
        mv foo scriptout
    endscript
}

--- NEW FILE: test-config.8.in ---
create

compress

&DIR&/test.log {
    monthly
    rotate 3
    mail user@xxxxxxxxxx
    mailfirst
    sharedscripts

    postrotate
        touch scriptout
        echo $(cat scriptout) foo > foo
        mv foo scriptout
    endscript
}

--- NEW FILE: test-config.9.in ---
create

compress

&DIR&/test.log {
    monthly
    rotate 0
    mail user@xxxxxxxxxx
    mailfirst
    sharedscripts

    postrotate
        touch scriptout
        echo $(cat scriptout) foo > foo
        mv foo scriptout
    endscript
}



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
hardware.arm.at...    cms.citadel.dev...    video.gstreamer...    java.facelets.u...    misc.basics.qna...    web.wiki.instik...    network.uip.use...    xdg.devel/2003-...    tex.bibtex.bibd...    finance.quotesp...    ietf.zeroconf/2...    redhat.blinux.g...    suse.db2/2003-0...    php.phpesp/2004...    uml.devel/2003-...    gnome.labyrinth...    qnx.openqnx.dev...    boot-loaders.gr...    db.dataperfect....    audio.audacity....    linux.uclinux.m...    editors.j.devel...    os.openbsd.tech...    kde.users.multi...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation