- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Cron messages
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
тАО02-02-2004 10:01 AM
тАО02-02-2004 10:01 AM
Cron messages
I want to disable mail messages on linux.. my archives on /var/spool/mail are too bigs. how can i do that?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-02-2004 12:58 PM
тАО02-02-2004 12:58 PM
Re: Cron messages
So if a job has an output (stout or sterror) and the job is called from root's crontab, then root will get a mail message.
HOWEVER, you can bypass this by redirecting outputs and errors to /dev/null.
For every entry in cron, end it with
> /dev/null 2>&1.
the above means redirect stout to /dev/null and send errors to the same place as stout.
for example, I have a script called mon_ps. I have an entry like
00,15,30,45 * * * * /home/admin/bin/mon_ps > /dev/null 2>&1
complications arise if you're using /etc/cron.daily , /etc/cron.hourly etc. If you do, the only solution I can think of would be to move these files to a different location and call them via crontab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-02-2004 02:20 PM
тАО02-02-2004 02:20 PM
Re: Cron messages
However, you will still get mail messages. You can forward root's messages to your own box by creating a .forward file in root's home.
If your box is running fine these mails shouldnt get unmanageable unless you have a large number of machines to admin which is another story...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-02-2004 05:13 PM
тАО02-02-2004 05:13 PM
Re: Cron messages
echo "" > /var/spool/mail/username
where username is the user who gets too much mail.
Or you could create a dummy account that does not get mail (redirect to /dev/null) and send the cron messages to that account (see cron man page and the MAILTO environment variable).
Hope this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-02-2004 07:05 PM
тАО02-02-2004 07:05 PM
Re: Cron messages
You can also tune main messages source, which could be a good idea, to set up warnings to a higher level, so that you still get important messages from your services, and not all the dummy things that are just normal activity informations.
hth
J
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-02-2004 07:46 PM
тАО02-02-2004 07:46 PM
Re: Cron messages
To clean up your /var/spool/mail, remove the files or empty them. Redirecting the null command is enough:
> /var/spool/mail/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-02-2004 09:21 PM
тАО02-02-2004 09:21 PM
Re: Cron messages
What you are better off doing however is this:
tar cvf /var/log/maillog /dev/rmt/0m
replace the last part with a tape device or a filesytem
then
> /var/log/maillog
That will zero it out.
Its bad to stop sendmail logging.
If this server is on the public internet this log is a critical audit trail in case someone tries to relay spam off your server.
I have recently had a security flaw exploited in which cgi scripts were used to relay mail. This was done to aol and with the help of the maillog I was able to shut it down.
If I'd had no maillog my only clue would have been aol stopping my mail acceptance, which they did TWO weeks after I shut off the spigot.
I was able to prove to aol that it was an aol customer doing the exploit, submitted my logs and got off the black list.
The point is simple. You need to have a maillog. You need to write a few scripts to scan it for warning signs so you can look at it
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com