summaryrefslogtreecommitdiff
blob: 16be3da673dada59d15945f23251a502e69a1c0f (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
--- debian/cron.daily
+++ debian/cron.daily
@@ -1,12 +1,25 @@
 #! /bin/sh
+
+. /etc/init.d/functions.sh 2>/dev/null
+on_ac_power 2>/dev/null #312583
+[ $? -eq 1 ] && exit 0
 
-if [ -x /usr/bin/slocate ]
+if [ -x /usr/bin/updatedb ]
 then
 	if [ -f /etc/updatedb.conf ]
 	then
-		/usr/bin/updatedb
+		. /etc/updatedb.conf
+		args=""
 	else
-		/usr/bin/updatedb -f proc
+		args="-f proc"
 	fi
-	chown root.slocate /var/lib/slocate/slocate.db
+
+	# run on active process in case ionice isnt installed, or
+	# system is really old and ionice doesnt work ...
+	ioflags=
+	[ -n "${IONICE_CLASS}"    ] && ioflags="-c ${IONICE_CLASS}"
+	[ -n "${IONICE_PRIORITY}" ] && ioflags="-n ${IONICE_PRIORITY}"
+	[ -n "${ioflags}" ] && ionice ${ioflags} -p $$ 2>/dev/null
+
+	nice -n ${NICE:-10} /usr/bin/updatedb ${args}
 fi