-
Notifications
You must be signed in to change notification settings - Fork 1
/
testlogrotate.sh
executable file
·57 lines (46 loc) · 1.64 KB
/
testlogrotate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#! /bin/sh
set -e
rm -rf testlogrotate.d
mkdir testlogrotate.d
cat >testlogrotate.d/logrotate.conf <<EOF
include `pwd`/testlogrotate.d/logrotate.d
EOF
mkdir testlogrotate.d/logrotate.d
cat >testlogrotate.d/logrotate.d/ntp <<EOF
`pwd`/testlogrotate.d/rc.d/ntp restart
`pwd`/testlogrotate.d/rc.d/ldap restart
EOF
mkdir testlogrotate.d/rc.M
>testlogrotate.d/rc.M/ntp
$srcdir/vera-logrotate-migrate \
`pwd`/testlogrotate.d/logrotate.conf \
`pwd`/testlogrotate.d/logrotate.conf.vera \
`pwd`/testlogrotate.d/logrotate.d \
`pwd`/testlogrotate.d/logrotate.d.vera \
`pwd`/testlogrotate.d/rc.d \
`pwd`/testlogrotate.d/rc.M
>testlogrotate.d/logrotate.d.vera/xxxx
$srcdir/vera-logrotate-migrate \
`pwd`/testlogrotate.d/logrotate.conf \
`pwd`/testlogrotate.d/logrotate.conf.vera \
`pwd`/testlogrotate.d/logrotate.d \
`pwd`/testlogrotate.d/logrotate.d.vera \
`pwd`/testlogrotate.d/rc.d \
`pwd`/testlogrotate.d/rc.M
echo "logrotate.conf.vera:" >testlogrotate.d.out
cat testlogrotate.d/logrotate.conf.vera >>testlogrotate.d.out
echo "logrotate.d.vera:" >>testlogrotate.d.out
ls testlogrotate.d/logrotate.d.vera >>testlogrotate.d.out
echo "logrotate.d.vera/ntp:" >>testlogrotate.d.out
cat testlogrotate.d/logrotate.d.vera/ntp >>testlogrotate.d.out
cat >testlogrotate.d.expected <<EOF
logrotate.conf.vera:
include `pwd`/testlogrotate.d/logrotate.d.vera
logrotate.d.vera:
ntp
logrotate.d.vera/ntp:
vlad restart system/rc.M/ntp
`pwd`/testlogrotate.d/rc.d/ldap restart
EOF
diff -U 3 testlogrotate.d.expected testlogrotate.d.out
rm -rf testlogrotate.d.expected testlogrotate.d.out testlogrotate.d