We have a number of cron jobs that collect various stats over a rather large network. Most of these cron jobs don't get monitored very well. I wanted to write a perl script that we could pipe the output of these jobs into, something like this:
5 * * * * collectstats.pl 2>&1 1>/dev/null | scriptwatcher.pl
The idea is that stdout from collectstats.pl is discarded and stderr is piped into scriptwatcher.pl. This second script can then take appropriate action in the case of errors, most likely email me. With a quick test this is working except that in scriptwatcher I need to know the name of the script that is sending it errors. With just that one little piece of information everything I want to do becomes possible.
Also, is it possible to pipe the stdout from collectstats into another script at the same time? ie 2 pipes for the one script?
Cheers