File: apt-cacher-ng.cron.daily

package info (click to toggle)
apt-cacher-ng 3.7.5-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,312 kB
  • sloc: cpp: 20,821; sh: 641; perl: 383; makefile: 147
file content (32 lines) | stat: -rw-r--r-- 1,185 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
#!/bin/sh
# Run the expire function of apt-cacher-ng non-interactively (unless errors 
# are detected).

# optional, specify hostname to appear in error messages and links
# HOSTNAME=externallyVisibleHostName
# export HOSTNAME

test -x /usr/lib/apt-cacher-ng/acngtool || exit 0

if test -e /etc/default/apt-cacher-ng
then
        . /etc/default/apt-cacher-ng
        test -z "$NO_CRON_RUN" || exit 0
fi

if [ -d /var/log/apt-cacher-ng ]; then
		# rm older than 10 days
		find /var/log/apt-cacher-ng -maxdepth 1 -name 'maint_*.log.html.xz' -or -name 'maint_*.log.html' -type f -user apt-cacher-ng -mtime +10 -delete
		# compress older than 5 days
		find /var/log/apt-cacher-ng -maxdepth 1 -name 'maint_*.log.html' -type f -user apt-cacher-ng -mtime +5 -print0 | xargs -r0 xz
fi

rpage=$(/usr/lib/apt-cacher-ng/acngtool -c /etc/apt-cacher-ng 2>/dev/null printvar ReportPage)
if test 0 = $(echo "$rpage" | wc -w)
then
	echo Warning: ReportPage setting of apt-cacher-ng was disabled by administrator. >&2
	echo See /usr/share/doc/apt-cacher-ng/README.Debian for details. >&2
	exit 42
fi

/usr/lib/apt-cacher-ng/acngtool maint -c /etc/apt-cacher-ng SocketPath=/var/run/apt-cacher-ng/socket