summaryrefslogtreecommitdiffstats
path: root/bin/housekeeping.sh
blob: c146b60df07802deb39eba4a1137b05f1c7afe83 (plain)
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
#/bin/bash
# FIXME: make this a general and a specific housekeeping job:

# Copyright 2012 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2

#
# default settings
#
export LC_ALL=C

echo 
uptime

echo
df -h

echo
for DIR in /var/cache/apt/archives/ /var/spool/squid/ /var/cache/pbuilder/build/ /var/lib/jenkins/jobs/ ; do
	sudo du -sh $DIR 2>/dev/null
done

echo
vnstat


CHROOT_PATTERN="/chroots/chroot-tests-*"
HOUSE=$(ls $CHROOT_PATTERN 2>/dev/null)
if [ "$HOUSE" != "" ] ; then
	figlet "Warning:"
	echo
	echo "Probably manual cleanup needed:"
	echo
	echo "$ ls -la $CHROOT_PATTERN"
	# List the processes using the partition
	echo
	fuser -mv $CHROOT_TARGET
	echo $HOUSE
	exit 1
fi

# FIXME: no tmpfs should really mean exit 1 not 0
df |grep tmpfs > /dev/null || ( echo "Warning: no tmpfs mounts in use. Please investigate the host system." ; exit 0 )

echo
echo "No problems found, all seems good."
figlet "Ok."