Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-01-2002, 10:22 AM   #1 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,475
sde is on a distinguished road
more cron jobs

I've dedicated this morning to understanding crontab. I am finally beginning to get it.

I set a cron on a file called stats.pl .. stats.pl is a perl script that looks at my gameserver logs and generates stats.

whenever i run ./stats.pl , it generates an error for each line it doesn't recognize .. usually there are a few errors but they're more like warnings .. it doesn't mean anything.

so here is my problem. The cronjob runs every half hour .. and it works great , but i get emailed all the errors that occur durring the stats.pl script. is there a way to make it so the system doesn't email me when errors occur within the stats.pl script itself?
sde is offline   Reply With Quote
Old 06-01-2002, 10:33 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,475
sde is on a distinguished road
well, i was able to use regexp to filter out the lines that were causing errors in the stats.pl script. i guess this is a better solution anyhow. if there are no errors in the first place, then i won't get emails =)
sde is offline   Reply With Quote
Old 06-01-2002, 10:44 AM   #3 (permalink)
revolution
Legend in my own mind
 
revolution's Avatar
 
Join Date: May 2002
Location: florida
Posts: 618
revolution is on a distinguished road
Send a message via AIM to revolution
yeah prolly good thinking , but if you dont want it to mail to ya, you can point it to a log file or to /dev/null
Code:
cmd >> log.file
if you wish not to see it at all....i found this on google for an intro into cron.......


http://www.unixgeeks.org/security/ne...ix/cron-1.html

hope it helps a little bit
__________________
Is it me or does the word abbreviation seem a little long?


registered user #193524 with the Linux Counter,
http://counter.li.org
revolution is offline   Reply With Quote
Old 06-01-2002, 02:00 PM   #4 (permalink)
bdl
Senior Contributor
 
Join Date: May 2002
Location: vta.ca.usa
Posts: 555
bdl is on a distinguished road
You might try something like this, it'll redirect the output of your errors to /dev/null or to a logfile of your choosing. Remember that anything in the crontab must use absolute paths, so you can't just stick ~/cron.log into a crontab entry.

Code:
## example crontab to redirect error output

# will send to the bit bucket
0-59/1 * * * *    exec /path/to/command 2&1> /dev/null

# will send to a log file
0-59 * * * *    exec /path/to/othercommand 2&1> /home/username/logs/command.log
Hope this helps!

BTW, the 2 is the shell's standard error output channel, while 1 is the shell's standard output channel. You can use one or both to redirect output from commands.
bdl is offline   Reply With Quote
Old 06-03-2002, 08:29 AM   #5 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,475
sde is on a distinguished road
thanks a lot .. that makes perfect sense!
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CLI for noobies: stay regular with cron and crontab sde Code Newbie News 1 04-05-2004 05:24 PM
I.B.M. Explores Shift of White-Collar Jobs Overseas rdove Code Newbie News 9 07-23-2003 07:19 PM
CRON misfunctionality Antagony Linux / BSD / OS X 2 03-20-2003 09:57 PM
Help!!! Cron Job Gone Crazy!!! sde Linux / BSD / OS X 3 05-23-2002 06:46 PM


All times are GMT -8. The time now is 11:14 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting