crontab Daemon-from-Hell
Tom Neff
tneff at bfmny0.UUCP
Sat Jun 3 10:48:55 AEST 1989
In article <19071 at cup.portal.com> thad at cup.portal.com (Thad P Floryan) writes:
> #sccs "@(#)uucp:uudemon.day 1.1"
> # 'perform once per day at 0400 hours'
> .
> .
> cd /usr/spool/uucppublic
> find . -type f -mtime +30 -exec rm -f {} \;
This is dangerous if run as root. If anything - disk error, anything -
happens to make /usr/spool/uucppublic unavailable, you will wipe your
file structure.
There are three things one can do - not mutually exclusive.
1) Trap the cd failure as follows -
cd /usr/spool/uucppublic || exit 1
2) Perform the find explicitly rather than relatively:
find /usr/spool/uucppublic -type f -mtime ... etc etc
3) Safest of all, and what I do - put this stuff in uucp's cron rather
than root's at all. It's also OK to let the root cron entry do an
'su uucp' first.
The best thing to do, and what I'll do tomorrow after reading the AQA,
is add (2) to (3). This may render the 'cd' irrelevant but who cares.
--
Tom Neff UUCP: ...!uunet!bfmny0!tneff
"Truisms aren't everything." Internet: tneff at bfmny0.UU.NET
More information about the Unix-pc.general
mailing list