hi,
i ve constructed a script to monitor the crond ,if the crond service is not available/not running then a mail ll be sent the mention mail id.. here the code
then i ve given the entry for cron as
Now the issue is though the crond is running me getting the alert each minute. Where im going wrong
Moderator's Comments:
Please use [code] and [/code] tags when posting code, data or logs etc. to preserve formatting and enhance readability. Also please refrain from overly use of font formatting, thanks.
Last edited by zaxxon; 05-19-2011 at 09:44 AM..
Reason: code tags, fonts etc.
Add set -x at the beginning of your script.
Use following line in crontab:
My guess is, that there will not be "running" in that $crond, since you don't have PATHs etc. available when starting scripts via cron. You have no environment active so commands like service, cut, awk, grep... will not be found and so with produce some errors where the test fails.
After a run there should be a log file /tmp/mycron.log where the output can be analyzed.
Excuse me if, but are you trying to monitor cron by using cron? If crond isn't running, neither will your script, and you won't get any notification anyways.
hi zaxxon,thanks for ur comments and then U r rite , i got some error in the logs as
now what can i do , now to get the environment .. Myself newbie to the scripting provide some solutions..
---------- Post updated 05-20-11 at 12:57 AM ---------- Previous update was 05-19-11 at 11:35 PM ----------
Quote:
Originally Posted by pludi
Excuse me if, but are you trying to monitor cron by using cron? If crond isn't running, neither will your script, and you won't get any notification anyways.
fine pludi .. valuable point , let assume the same code for httpd service now whats your solution?????? may i know that?
For httpd it would work, as long as cron is running. The path issue aside your script already does what it should do, you only have to hard-code the complete path to the service command (which service). But it's just not possible to monitor if a program is running from within that program. Think about it this way: if you are alive, you can tell if someone else is alive, and you know that you yourself are alive. But if you're dead, you have no way of telling that to anyone.
For httpd it would work, as long as cron is running. The path issue aside your script already does what it should do, you only have to hard-code the complete path to the service command (which service). But it's just not possible to monitor if a program is running from within that program. Think about it this way: if you are alive, you can tell if someone else is alive, and you know that you yourself are alive. But if you're dead, you have no way of telling that to anyone.
ok ok got ur point ... could u suggest me some other script to monitor the httpd service and send me alert when the service is offline...
Dear experts,
I'm newbie to awk scripting. Need your great help to convert the irregular lines into column using awk in windows2003 server environment. (Sorting based on "Pri Number" column)
Input files is as follows:
Partition Name: OA
Partition UID: ... (0 Replies)