1 |
scarabeus 11/01/24 12:39:33 |
2 |
|
3 |
Modified: mlocate.cron-r2 updatedb.conf mlocate-cron.conf |
4 |
Log: |
5 |
Update cronscript and config to be more strict and flexible. |
6 |
|
7 |
(Portage version: 2.2.0_alpha19/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.2 sys-apps/mlocate/files/mlocate.cron-r2 |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/mlocate/files/mlocate.cron-r2?rev=1.2&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/mlocate/files/mlocate.cron-r2?rev=1.2&content-type=text/plain |
14 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/mlocate/files/mlocate.cron-r2?r1=1.1&r2=1.2 |
15 |
|
16 |
Index: mlocate.cron-r2 |
17 |
=================================================================== |
18 |
RCS file: /var/cvsroot/gentoo-x86/sys-apps/mlocate/files/mlocate.cron-r2,v |
19 |
retrieving revision 1.1 |
20 |
retrieving revision 1.2 |
21 |
diff -u -r1.1 -r1.2 |
22 |
--- mlocate.cron-r2 18 Nov 2009 10:29:13 -0000 1.1 |
23 |
+++ mlocate.cron-r2 24 Jan 2011 12:39:33 -0000 1.2 |
24 |
@@ -1,22 +1,48 @@ |
25 |
#! /bin/sh |
26 |
+set -e |
27 |
|
28 |
-if [ -x /usr/bin/updatedb ] |
29 |
-then |
30 |
- if [ -f /etc/updatedb.conf ] |
31 |
- then |
32 |
- args="" |
33 |
- else |
34 |
- args="-f proc" |
35 |
+# check if we run on battery and if so then don't run |
36 |
+if which on_ac_power >/dev/null 2>&1; then |
37 |
+ ON_BATTERY=0 |
38 |
+ on_ac_power >/dev/null 2>&1 || ON_BATTERY=$? |
39 |
+ if [ "${ON_BATTERY}" -eq 1 ]; then |
40 |
+ exit 0 |
41 |
fi |
42 |
+fi |
43 |
|
44 |
- if [ -f /etc/mlocate-cron.conf ] |
45 |
- then |
46 |
- . /etc/mlocate-cron.conf |
47 |
- fi |
48 |
+# check if we are already running (lockfile) |
49 |
+LOCKFILE="/var/lock/mlocate.daily.lock" |
50 |
+trap "rm -f ${LOCKFILE}" EXIT |
51 |
+if [ -e "${LOCKFILE}" ]; then |
52 |
+ echo >&2 "Warning: \"${LOCKFILE}\" already present, not running updatedb." |
53 |
+ exit 1 |
54 |
+else |
55 |
+ touch "${LOCKFILE}" |
56 |
+fi |
57 |
+ |
58 |
+# source the user specified variables |
59 |
+if [ -f /etc/mlocate-cron.conf ]; then |
60 |
+ . /etc/mlocate-cron.conf |
61 |
+fi |
62 |
+ |
63 |
+# check the config file |
64 |
+ARGS="" |
65 |
+if [ ! -f /etc/updatedb.conf ]; then |
66 |
+ nodevs=$(< /proc/filesystems awk '$1 == "nodev" && $2 != "rootfs" { print $2 }') |
67 |
+ ARGS="-f ${nodevs}" |
68 |
+fi |
69 |
|
70 |
- # run on active process in case ionice isnt installed, or |
71 |
- # system is really old and ionice doesnt work ... |
72 |
- ionice -c ${IONICE_CLASS:-2} -n ${IONICE_PRIORITY:-7} -p $$ 2>/dev/null |
73 |
+# alter the priority of the updatedb process |
74 |
+if [ -x /usr/bin/renice ]; then |
75 |
+ /usr/bin/renice +${NICE:-19} -p $$ > /dev/null 2>&1 |
76 |
+if [ -x /usr/bin/ionice ] && /usr/bin/ionice -c3 true 2>/dev/null; then |
77 |
+ /usr/bin/ionice -c${IONICE_CLASS:-2} -n${IONICE_PRIORITY:-7} -p $$ > /dev/null 2>&1 |
78 |
+fi |
79 |
|
80 |
- nice -n ${NICE:-10} /usr/bin/updatedb ${args} |
81 |
+# run the updatedb if possible |
82 |
+if [ -x /usr/bin/updatedb ]; then |
83 |
+ /usr/bin/updatedb ${ARGS} |
84 |
+else |
85 |
+ echo >&2 "Warning: \"/usr/bin/updatedb\" is not executable, unable to run updatedb." |
86 |
+ exit 0 |
87 |
fi |
88 |
|
89 |
|
90 |
|
91 |
1.5 sys-apps/mlocate/files/updatedb.conf |
92 |
|
93 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/mlocate/files/updatedb.conf?rev=1.5&view=markup |
94 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/mlocate/files/updatedb.conf?rev=1.5&content-type=text/plain |
95 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/mlocate/files/updatedb.conf?r1=1.4&r2=1.5 |
96 |
|
97 |
Index: updatedb.conf |
98 |
=================================================================== |
99 |
RCS file: /var/cvsroot/gentoo-x86/sys-apps/mlocate/files/updatedb.conf,v |
100 |
retrieving revision 1.4 |
101 |
retrieving revision 1.5 |
102 |
diff -u -r1.4 -r1.5 |
103 |
--- updatedb.conf 21 Nov 2010 14:57:13 -0000 1.4 |
104 |
+++ updatedb.conf 24 Jan 2011 12:39:33 -0000 1.5 |
105 |
@@ -1,14 +1,17 @@ |
106 |
# /etc/updatedb.conf: config file for slocate |
107 |
-# $Id: updatedb.conf,v 1.4 2010/11/21 14:57:13 fauli Exp $ |
108 |
+# $Id: updatedb.conf,v 1.5 2011/01/24 12:39:33 scarabeus Exp $ |
109 |
|
110 |
# This file sets variables that are used by updatedb. |
111 |
# For more info, see the updatedb.conf(5) manpage. |
112 |
|
113 |
# Filesystems that are pruned from updatedb database |
114 |
-PRUNEFS="afs auto autofs cifs devfs devpts eventpollfs futexfs gfs hostfs hugetlbfs iso9660 mqueue ncpfs nfs NFS nfs4 nfsd nnpfs ocfs ocfs2 pipefs proc ramfs rpc_pipefs selinuxfs sfs shfs smbfs sockfs spufs subfs supermount sysfs tmpfs udf usbfs vperfctrfs" |
115 |
+PRUNEFS="afs anon_inodefs auto autofs bdev binfmt binfmt_misc cgroup cifs coda configfs cramfs cpuset debugfs devpts devtmps devfs devpts ecryptfs eventpollfs exofs futexfs ftpfs fuse fusectl gfs gfs2 hostfs hugetlbfs inotifyfs iso9660 jffs2 lustre misc mqueue ncpfs nfs NFS nfs4 nfsd nnpfs ocfs ocfs2 pipefs proc ramfs rpc_pipefs securityfs selinuxfs sfs shfs smbfs sockfs spufs sshfs subfs supermount sysfs tmpfs ubifs udf usbfs vboxsf vperfctrfs" |
116 |
|
117 |
# Paths which are pruned from updatedb database |
118 |
-PRUNEPATHS="/tmp /var/tmp /root/.ccache" |
119 |
+PRUNEPATHS="/tmp /var/tmp /var/cache /var/lock /var/run /var/spool" |
120 |
+ |
121 |
+# Folder names that are pruned from updatedb database |
122 |
+PRUNENAMES=".git .hg .svn CVS" |
123 |
|
124 |
# Skip bind mounts. |
125 |
-PRUNE_BIND_MOUNTS="no" |
126 |
+PRUNE_BIND_MOUNTS="yes" |
127 |
|
128 |
|
129 |
|
130 |
1.2 sys-apps/mlocate/files/mlocate-cron.conf |
131 |
|
132 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/mlocate/files/mlocate-cron.conf?rev=1.2&view=markup |
133 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/mlocate/files/mlocate-cron.conf?rev=1.2&content-type=text/plain |
134 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/mlocate/files/mlocate-cron.conf?r1=1.1&r2=1.2 |
135 |
|
136 |
Index: mlocate-cron.conf |
137 |
=================================================================== |
138 |
RCS file: /var/cvsroot/gentoo-x86/sys-apps/mlocate/files/mlocate-cron.conf,v |
139 |
retrieving revision 1.1 |
140 |
retrieving revision 1.2 |
141 |
diff -u -r1.1 -r1.2 |
142 |
--- mlocate-cron.conf 7 Sep 2008 02:12:11 -0000 1.1 |
143 |
+++ mlocate-cron.conf 24 Jan 2011 12:39:33 -0000 1.2 |
144 |
@@ -1,5 +1,5 @@ |
145 |
# nice value to run at: see -n in nice(1) |
146 |
-NICE="10" |
147 |
+NICE="19" |
148 |
|
149 |
# ionice class to run at: see -c in ionice(1) |
150 |
# you have to install sys-apps/util-linux manually |