- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: find command in crontab
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2010 05:35 AM
тАО03-29-2010 05:35 AM
For some reason this does not work...
00 11 * * * find /home/oracle/scripts/logs/*acdb_online_backup_level* -mtime -14 -exec rm -rf {} + 2>/dev/null
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2010 05:44 AM
тАО03-29-2010 05:44 AM
Re: find command in crontab
I don't see any special "%" chars.
What HP-UX version are you using?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2010 05:44 AM
тАО03-29-2010 05:44 AM
SolutionWhenever you use shell wildcards (metacharacters) with a 'find' command, you should quote the argument to avoid interpretation by the shell. Too, your 'cron' environment is very likely to differ from your normal login one. Try:
# 00 11 * * * find "/home/oracle/scripts /logs/*acdb_online_backup_level*" -mtime -14 -exec rm -rf {} + 2>/dev/null
That said, I really think you want to do:
# 00 11 * * * find /home/oracle/scripts/logs -name "*acdb_online_backup_level*" -mtime -14 -exec rm -rf {} + 2>/dev/null
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2010 07:19 AM
тАО03-29-2010 07:19 AM
Re: find command in crontab
I see it run in the cron log. So cron does run, but have tried multiple ways.
05 10 * * * find /home/oracle/scripts/logs -name "*acdb_online_backup_level*" -mtime -1 -exec rm -rf {} + 2>/dev/null
05 10 * * * find /home/oracle/scripts/logs -name "*acdb_archivelog_backup*" -mtime -1 -exec rm -rf {} + 2>/dev/null
15 10 * * * find "/home/oracle/scripts/logs/*acdb_archivelog_backup*" -mtime -1 -exec rm -rf {} + 2>/dev/null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2010 07:32 AM
тАО03-29-2010 07:32 AM
Re: find command in crontab
I would modify the script so that it e-mails you error rather than just sending them to /dev/null.
find "/home/oracle/scripts/logs/*acdb_archivelog_backup*" -mtime -1 -exec rm -rf {} + 2>&1 | mailx -s "find output" you@someaddress.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2010 08:53 AM
тАО03-29-2010 08:53 AM
Re: find command in crontab
-rf {} + 2>&1 |
be...
-rf {} \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2010 09:01 AM
тАО03-29-2010 09:01 AM
Re: find command in crontab
> Michael: Shouldn't... -rf {} + 2>&1 | be...
-rf {} \;
No. Using the '+' terminator with '-exec' greatly improves performance. Multiple arguments are collected and passed to each process spawned. This acts much like a pipeline to 'xargs' would and has been available since 11.0.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2010 09:42 AM
тАО03-29-2010 09:42 AM
Re: find command in crontab
find /home/oracle/scripts/logs/*acdb_online_backup_level*.log
But once I add the -mtime -1 or any number, I get nothing.
Exactly the same thing if I run it like:
find /home/oracle/scripts/logs -name "*acdb_online_backup_level*.log"
-get results
find /home/oracle/scripts/logs -name "*acdb_online_backup_level*.log" -mtime -5
-No results
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2010 09:45 AM
тАО03-29-2010 09:45 AM
Re: find command in crontab
mtime +5! Not -5
Arggg!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2010 09:59 AM
тАО03-29-2010 09:59 AM