Subversion Repositories public

Rev

Rev 51 | Rev 59 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 51 Rev 55
Line 21... Line 21...
21
#include <syslog.h>
21
#include <syslog.h>
22
#include <errno.h>
22
#include <errno.h>
23
#include <sys/poll.h>
23
#include <sys/poll.h>
24
24
25
#include "inotify-cxx.h"
25
#include "inotify-cxx.h"
26
#include "incrontab.h"
-
 
27
26
-
 
27
#include "incron.h"
-
 
28
#include "incrontab.h"
28
#include "usertable.h"
29
#include "usertable.h"
29
30
30
/// Daemon yes/no
31
/// Daemon yes/no
31
#define DAEMON true
32
#define DAEMON true
32
33
33
/// Application name
-
 
34
#define INCRON_APP_NAME "incrond"
-
 
35
-
 
36
/// Logging options (console as fallback, log PID)
34
/// Logging options (console as fallback, log PID)
37
#define INCRON_LOG_OPTS (LOG_CONS | LOG_PID)
35
#define INCRON_LOG_OPTS (LOG_CONS | LOG_PID)
38
36
39
/// Logging facility (use CRON)
37
/// Logging facility (use CRON)
40
#define INCRON_LOG_FACIL LOG_CRON
38
#define INCRON_LOG_FACIL LOG_CRON
Line 126... Line 124...
126
 *
124
 *
127
 * \attention In daemon mode, it finishes immediately.
125
 * \attention In daemon mode, it finishes immediately.
128
 */
126
 */
129
int main(int argc, char** argv)
127
int main(int argc, char** argv)
130
{
128
{
131
  openlog(INCRON_APP_NAME, INCRON_LOG_OPTS, INCRON_LOG_FACIL);
129
  openlog(INCRON_DAEMON_NAME, INCRON_LOG_OPTS, INCRON_LOG_FACIL);
132
 
130
 
133
  syslog(LOG_NOTICE, "starting service");
131
  syslog(LOG_NOTICE, "starting service (version %s, built on %s %s)", INCRON_VERSION, __DATE__, __TIME__);
134
 
132
 
135
  try {
133
  try {
136
    Inotify in;
134
    Inotify in;
137
    in.SetNonBlock(true);
135
    in.SetNonBlock(true);
138
   
136