Next | Welcome to my ~/bin | 79 |
Here's the meat of the program
It builds up a find command that searches the filesystem and prints a list of files:
my @COMMAND = ('find', $ROOT); push @COMMAND, ('-path', $_, '-prune', '-o' ) for @PRUNE; push @COMMAND, '-print';
open F, "> $OUTPUT" or die "$0: Couldn't open database file $OUTPUT: $!\n"; open STDOUT, ">&F" or die "$0: Couldn't dup to stdout: $!\n"; open SAVESTDERR, ">&STDERR" or die "$0: Couldn't dup to stderr: $!\n"; open STDERR, "> /dev/null" or die "$0: Couldn't discard stderr: $!\n"; close F;
exec @COMMAND; print SAVESTDERR "$0: Couldn't run 'find' command:\n\t@COMMAND\n\t$!\n"; exit 1;
This is run nightly from cron
It's run as user nobody rather than as root
That way, it will not reveal the existence of secret files
Next | Menu | Copyright © 2005 M. J. Dominus |