1 /* @(#) $Id: monitord.c,v 1.9 2009/06/24 17:06:27 dcid Exp $ */
3 /* Copyright (C) 2009 Trend Micro Inc.
6 * This program is a free software; you can redistribute it
7 * and/or modify it under the terms of the GNU General Public
8 * License (version 3) as published by the FSF - Free Software
18 /* Real monitord global */
28 char str[OS_SIZE_1024 +1];
30 /* Waiting a few seconds to settle */
33 memset(str, '\0', OS_SIZE_1024 +1);
36 /* Getting currently time before starting */
41 thismonth = p->tm_mon;
42 thisyear = p->tm_year+1900;
46 /* Connecting to the message queue
49 if((mond.a_queue = StartMQ(DEFAULTQUEUE,WRITE)) < 0)
51 ErrorExit(QUEUE_FATAL, ARGV0, DEFAULTQUEUE);
55 /* Sending startup message */
56 snprintf(str, OS_SIZE_1024 -1, OS_AD_STARTED);
57 if(SendMSG(mond.a_queue, str, ARGV0,
60 merror(QUEUE_SEND, ARGV0);
64 /* Main monitor loop */
71 /* Checking unavailable agents */
72 if(mond.monitor_agents)
77 /* Day changed, deal with log files */
78 if(today != p->tm_mday)
80 manage_files(today, thismonth, thisyear);
83 thismonth = p->tm_mon;
84 thisyear = p->tm_year+1900;
87 /* We only check every two minutes */