- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Re-direct statements in cron files
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
01-12-2005 07:53 AM
01-12-2005 07:53 AM
* * * * * /anyscript 1>/dev/null 2>&1
* * * * * /anyscript &2>> /dev/null
Also, if I want errors from anyscript to go to a file, what is the best redirect statement?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2005 07:57 AM
01-12-2005 07:57 AM
Re: Re-direct statements in cron files
- This will map STDOUT to null and then STDERR to the same as STDOUT (null)
&2>>/dev/null
- I think the "&" will launch the command as a background job, and 2>>/dev/null will step STDERR to null.
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2005 07:59 AM
01-12-2005 07:59 AM
Re: Re-direct statements in cron files
It looks to me like the first one sends standard out to the bit bucket and then sends standard error as well.
I'm not sure about the second one. It looks sort of like it's trying to run the process in the back ground and send std err to /dev/null?
Maybe one of the hats knows about that one.
-dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2005 08:07 AM
01-12-2005 08:07 AM
SolutionIf the 2nd example were correctly done then only stderr would be redirected. Stdout would remain unaffected.
The "best" way to redirect errors depends upon what you are trying to do at the moment.
One method from a script is to include a line like this early in the script:
exec 2>>/xxx/myerrs
Now all subsequent stderr output will be appended to the file /xxx/myerrs.
You could also do something like
exec 1>>/xxx/mylog
exec 2>&1
and now stdout and stderr would be sent to a file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2005 08:07 AM
01-12-2005 08:07 AM
Re: Re-direct statements in cron files
Maybe this would help you understand how the redirection works.
http://www.unet.univie.ac.at/aix/aixuser/usrosdev/input_output_redir_korn.htm
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2005 08:14 AM
01-12-2005 08:14 AM
Re: Re-direct statements in cron files
what is anyscript (the one from '* * * * * /anyscript &2>> /dev/null') for?
Do this script need parameters (something like '&2')?
If it needs this parameter, the rest is just a cute appending to /dev/null.
regards
Michael