Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Parsing and monitoring Crontabs

by JSchmitz (Canon)
on Jul 12, 2010 at 15:03 UTC ( #849025=note: print w/replies, xml ) Need Help??


in reply to Parsing and monitoring Crontabs

First of all welcome to Perl!

I have to say that I agree with JavaFan seems like you are re-inventing the wheel here not only can you look at the logs you can have status emailed to you
cmd | mail -s "Subject of mail" user

If you wish to mail the output to someone not located on the machine, in the above example, substitute user for the email address of the person who wishes to receive the output.

If you have a command that is run often, and you don't want to be emailed the output every time, you can redirect the output to a log file (or /dev/null, if you really don't want the output). e,g

cmd >> log.file
Notice we're using two > signs so that the output appends the log file and doesn't clobber previous output. The above example only redirects the standard output, not the standard error, if you want all output stored in the log file, this should do the trick:
cmd >> logfile 2>&1

You can then set up a cron job that mails you the contents of the file at specified time intervals, using the cmd:
mail -s "logfile for cmd" <log.file

Have fun!! oh and s/PERL/Perl

Cheers!!

Jeffery

Replies are listed 'Best First'.
Re^2: Parsing and monitoring Crontabs
by mcobbley (Initiate) on Jul 14, 2010 at 01:20 UTC
    Thank you to everyone that replied I will try your suggestions and let you know.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://849025]
help
Chatterbox?
[Tux]: Corion++ hippo++
[ovedpo15]: it isn't homework. its a module I use at work. The process to add additional module isn't worth it. p.s never heard a university course which teach perl
[marto]: there are many, to this day.
[ovedpo15]: @Corion Yes I use the regex you showed me. its very good regex. although now i need to know that substring unit that comma
marto mad corrections to one around 18 months ago
[ovedpo15]: my code checks the value after that comma, if it isn't valid it will remove it. so I would like to remove the substring after that comma meaning getting the string before comma.
[hippo]: Are you sure that Text::CSV_XS isn't already installed at your work? It's such a useful module that it might well be there.
[marto]: pointing out the advantages of cpan modules is well worth in, as both developer and $client/$company benefit greatly
[Tux]: $src =~ m{^(.*),(.*)$/ and $2 !~ $valid and $src = $1;
[Tux]: s,/,},

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2018-05-27 10:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?