File: custom-run

package info (click to toggle)
logrotate 3.22.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,152 kB
  • sloc: sh: 6,666; ansic: 5,245; makefile: 161
file content (55 lines) | stat: -rwxr-xr-x 876 bytes parent folder | download | duplicates (3)
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
#!/bin/sh

set -eu

# create "secure" dir to handle permissive umask settings
mkdir custom-test/
chmod 755 custom-test/
cd custom-test/

cat > config <<EOF
$(pwd)/test.log {
    create
    daily
    rotate 3
    compress
    delaycompress
}
EOF
chmod go-w config

cat > state <<EOF
logrotate state -- version 2
"$(pwd)/test.log" 2000-1-1
EOF

cat > test.log <<EOF
content 1
EOF

echo "== run #1"
/usr/sbin/logrotate --verbose -s state config 2>&1

echo "== checking test.log"
test -f test.log
echo "== checking test.log.1"
test -f test.log.1

cat > state <<EOF
logrotate state -- version 2
"$(pwd)/test.log" 2000-1-1
EOF

cat > test.log <<EOF
content 2
EOF

echo "== run #2"
/usr/sbin/logrotate --verbose -s state config 2>&1

echo "== checking test.log"
test -f test.log
echo "== checking test.log.1"
test -f test.log.1
echo "== checking test.log.2.gz"
test -f test.log.2.gz