On Tue, 2012-01-24 at 08:53 -0500, Alan Peterson wrote: > That's where I need a little aim in coming up with the syntax to > execute a proper cron job.
>From whatever user has read/write permissions to the files in question:, run 'crontab -e' to put you into an editor where you enter commands for cron. On many systems, this would be 'vi', but you may have set the variables for 'emacs' or another. Just be sure you know how to edit and save files and exit the program in whichever editor comes up. ;-) Once in the editor, enter something like the following, tailoring the path and time to your liking: #======================================================================== # field allowed values # ----- -------------- # minute 0-59 # hour 0-23 # day of month 1-31 # month 1-12 (or names, see below) # day of week 0-7 (0 or 7 is Sun, or use names) # 01 00 * * * find /audio/logger/*.wav -ctime +30 -print0 | xargs -0 rm -f #======================================================================== You can leave out all the lines starting with the hash; they're here for your reference. The one line starting with "01" is the only relevant one here. Explanation: 1. The system will find any "*.wav" file in the "/audio/logger/" directory that was created thirty or more days ago. 2. The 'rm -f' command after 'xargs' at the end of the find command tells the system to absolutely delete any file that match the criteria of the 'find' command. In your case, you'll likely want to use another similar 'find' command before this one to email you a summary (or the file, or whatever you want to do). Alternatively, something else you could do is to write a bash script containing commands to move them to an archive [external| flash] drive, email you the list of files it's going to modify/remove, run the above find command, etc. and then simply call the script in crontab instead of running the find command. For a more detailed explanation, consult the man page of crontab and find: 'man 5 crontab' 'man 1 find' Hope this helps. -- +----------------------------------+----------------------------------+ | Sherrod Munday | <[email protected]> | | Senior VP, Engineering | (423) 396-8130 (W) | | Sky Angel U.S., LLC | | +----------------------------------+----------------------------------+ _______________________________________________ Rivendell-dev mailing list [email protected] http://lists.rivendellaudio.org/mailman/listinfo/rivendell-dev
