TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
updatedb.cron doesn't work
I un-suided some programs and that might have caused this problem:
updated.cron (came with rh5.2) makes an empty locatedb file with perm 400.
Attached is the script -- the line:
su nobody -c "/usr/bin ...."
produces the empty file.. When I run the script as root I get: sync:
ignoring all arguments
Why is sync ignoring all arguments?
Ben Luey
lueyb@carleton.edu
ICQ: 19144397
I say if your knees aren't green by the end of the day, you ought to seriously
re-examine your life.
-- Calvin (Calvin & Hobbes) looking at his grass-stained knees after fun day
outside.
#!/bin/bash
umask=022
die ()
{
echo "$*" 1>&2
exit 1
}
cd /
TMPFILE=`/bin/mktemp /tmp/locatedb.XXXXXX` || {
echo "could not create tempfile" >&2 ; exit 1
}
chown nobody.nobody $TMPFILE
su nobody -c "/usr/bin/updatedb --output=$TMPFILE --localpaths='/' --prunepaths='/tmp /var/tmp /usr/tmp /afs /net' --netpaths='' 2>/dev/null"
SFILE=$TMPFILE
mv $SFILE /var/lib/locatedb || \
die "$0: could not create /var/lib/locatedb"
chown root.root /var/lib/locatedb || \
die "$0: could not change ownership of /var/lib/locatedb"
rm -rf $TMPFILE
exit 0