- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Help with 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
тАО01-08-2008 01:50 AM
тАО01-08-2008 01:50 AM
Help with Crontab
* * * * * /root/a.sh &> /dev/null
Exactly wht is this &> used for......Pls explain
- Tags:
- crontab
- redirection
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-08-2008 02:03 AM
тАО01-08-2008 02:03 AM
Re: Help with Crontab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-08-2008 02:12 AM
тАО01-08-2008 02:12 AM
Re: Help with Crontab
* * * * * /root/a.sh >/dev/null 2>&1
Why would you want to run a cronjob in the background?
Besides, should this job really run every minute?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-08-2008 02:18 AM
тАО01-08-2008 02:18 AM
Re: Help with Crontab
Linux distros are using the extended Vixie crontab format.
There you can place environments in a crontab,
and especially setting MAILTO here to an empty string should suppress the sending of the cronjobs output as mail to the owner of the cronjob; something one usually tries to achieve by redirecting stdout and stderr to /dev/null
(with conventional implementations of cron)
So you could place this line in the top of your crontab:
MAILTO=""
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-08-2008 03:01 AM
тАО01-08-2008 03:01 AM
Re: Help with Crontab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-08-2008 04:54 AM
тАО01-08-2008 04:54 AM
Re: Help with Crontab
means that the flow of following commands
(n.b. shell scripts basically aren't much more than a batch of commands/program calls)
won't be blocked until the execution of the current command has finished or is interrupted.
It can be used as a kind of forking to achieve asynchronous execution behavior.
I guess this was the intention here
as the by minute cronjob interval might be too narrow for the called script to have finished before the next cronjob is due, since no other command immediately follows the call.
With interactive shells that support job control the ampersand is used to regain the shell prompt to continue work while a probably long-running command is being executed in the background.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2009 05:02 PM
тАО06-03-2009 05:02 PM
Re: Help with Crontab
Ralph's comments are nearly correct, but it isn't a typo, and it isn't backgrounding the process, either.
Usually an "&" appended to the end of a command will cause that command to run in the background, but in this particular case, the "&> [file]" is a shorthand notation for the " >[file] 2>&1" notation (Ralph was close). Not a typo. It does NOT cause it to run in the background. This shorthand is recognized by bash, and probably other shells, also.
What these two variations do is redirect both stdout and stderr to the file specified. In this case, /dev/null, aka the bit bucket.
For more information, see the man page for bash, or whatever shell you found this being used in.