- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: crontab commands fail
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
Forums
Discussions
Discussions
Discussions
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
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
02-16-2009 07:09 PM
02-16-2009 07:09 PM
crontab commands fail
I am a DBA with HP in Sydney. We have a peculiar issue with crontab entries that we are unable to resolve.
A typical crontab entry looks like
NN NN * * * find
Now, if there are files in
I have tried modifying the command in various ways--one such attempt is listed below--but that fails as well.
NN NN * * * [ $(ls -1A
So, I try to count if there are files in
Is there a way to insulate commands in cron so that if there are no files to operate on, the command should just go away? Basically, if there are no files in
Please advise.
Thanks,
Kanwar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2009 07:26 PM
02-16-2009 07:26 PM
Re: crontab commands fail
What happens if you use a + at the end of the find command. The escaped \; is not going to work from crontabs.
Regards,
George
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2009 07:30 PM
02-16-2009 07:30 PM
Re: crontab commands fail
Thanks for the quick reply. Can you give me an example of how I can add the '+' at the end?
Is it:
NN NN * * * find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2009 08:21 PM
02-16-2009 08:21 PM
Re: crontab commands fail
Is this a better approach?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2009 09:28 PM
02-16-2009 09:28 PM
Re: crontab commands fail
If possible write a shell program and execute from crontab.
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2009 09:54 PM
02-16-2009 09:54 PM
Re: crontab commands fail
Thanks all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2009 12:11 AM
02-17-2009 12:11 AM
Re: crontab commands fail
>Is there a way to insulate commands in cron so that if there are no files to operate on, the command should just go away?
You can just ignore all errors from the find:
NN NN * * * find
>I have now modified it to find ... | xargs.
>Is this a better approach?
No, using a "+" is much better.
>George: What happens if you use a + at the end of the find command. The escaped \; is not going to work from crontabs.
Using "+" will make it faster. But the "\;" should also work.
>Suraj: write a shell program and execute from crontab.
Yes, a shell script will allow you to set the exit status and check for no matches.