Dylan Penhale wrote:
> #Rush - log files and folders
> "find /server/resources/logs/rush -name "*.log" -ctime +14 -ls -exec rm -rf {} \;
The thing that scares me about commands like this is
what if someone happens to create a filename with spaces, eg:
mkdir "/server/resources/logs/rush/somedir "; touch "/server/resources/logs/rush/somedir /root"
..with a command like that, in 14 days will it construct
an 'rm' command that looks like:
rm -rf /server/resources/logs/rush/somedir /root
..and blow away the /root directory? ;D
It shouldn't; find(1) is /supposed/ to guarantee the command
will be executed such that {} will be passed to rm as a single argument,
but it makes you think twice.. especially across platforms and OS updates.
Certainly the OS does global core removals that same way. *Still* it makes
it hard to sleep at night ;) I've seen bugs creep into vendor specific
rm(1) and find(1) commands that are.. scary.
It's that kind of thing that worries me, someone coming up with some
nutty platform or situation where the rm -rf somehow sneaks out into
unexpected parts of the file system, and a whole prod dir disappears.
--
Greg Ercolano, erco@(email surpressed)
Seriss Corporation
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)ext.23
Fax: (Tel# suppressed)
Cel: (Tel# suppressed)
|