[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

8685.0. "crontab and find, 3.2d" by STOSS1::HORVATH () Mon Feb 03 1997 12:06

    Hello,
    
    Have the following crontab entry which works fine but I need a log copy
    of the files deleted, how can I achieve this?  I'm having trouble
    directing the output.
    
    
08 00 * * * find / \( -name core \) -exec rm -f {} \;
    
    Thanks,
    
    
T.RTitleUserPersonal
Name
DateLines
8685.1One work-aroundGREGOR::OPPMon Feb 03 1997 13:1711
    	One method that works is to embed the command within a command
    file and then queue the command file for execution.  So, your entry
    would become something like
    
    	08 00 * * ...     /usr/users/command_file
    
    and command_file would contain your find command and possibly a cd 
    command, if necessary.  
    
    Greg
    
8685.2BIGUN::nessus.cao.dec.com::MayneWake up, time to dieMon Feb 03 1997 21:516
Just off the top of my head:

08 00 * * * find / -name core|tee /var/tmp/delfiles.txt|xargs rm -f

but as .1 says, you might want to put this in a script.
PJDM