File: htcacheclean

package info (click to toggle)
apache2 2.4.62-1~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 59,516 kB
  • sloc: ansic: 216,122; python: 15,147; perl: 11,308; sh: 6,449; php: 1,315; javascript: 1,314; awk: 749; makefile: 714; lex: 374; yacc: 161; xml: 2
file content (70 lines) | stat: -rw-r--r-- 1,140 bytes parent folder | download | duplicates (5)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
set -exu

fatal () {
	echo "ERROR: $@" >&2
	exit 1
}

skip () {
	echo "ERROR: $@" >&2
	exit 77
}

htc_enabled () {
	if ls /etc/rc[2345].d/S*apache-htcacheclean > /dev/null 2>&1 ; then
		return 0
	else
		return 1
	fi
}

if htc_enabled ; then
	fatal "apache-htcacheclean should not be enabled"
fi

a2enmod cache_disk

if ! htc_enabled ; then
	fatal "apache-htcacheclean should be enabled"
fi

service apache-htcacheclean start

# for debugging
ps -ef|grep /usr/bin/htcacheclean || true

PGREP="pgrep -P 1 -u www-data -G www-data htcacheclean"

if ! $PGREP ; then
	fatal "htcacheclean is not running or running as wrong user/group"
fi

if ! service apache-htcacheclean status ; then
	fatal "status did not return 'running'"
fi

service apache-htcacheclean stop
sleep 1

if $PGREP ; then
	skip "htcacheclean did not stop"
fi

if service apache-htcacheclean status ; then
	fatal "status did not return 'stopped'"
fi

a2dismod cache_disk

if htc_enabled ; then
	fatal "apache-htcacheclean should not be enabled"
fi

a2enmod cache_socache

if htc_enabled ; then
	fatal "apache-htcacheclean has been enabled for cache_socache"
fi

exit 0