/[projects]/smsdaemon/main.cpp
ViewVC logotype

Diff of /smsdaemon/main.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 88 by torben, Mon Jun 16 09:04:05 2008 UTC revision 146 by torben, Sun Dec 7 20:06:12 2008 UTC
# Line 1  Line 1 
1  #include <string>  #include <string>
2    #include <stdlib.h>
3    
4  #include "daemon.h"  #include "daemon.h"
5  #include "common.h"  #include "common.h"
6    
7  #include "GsmModem.h"  #include "GsmModem.h"
8  #include "SerialPort.h"  #include "serialport/SerialPort.h"
9  #include "SmsDaemon.h"  #include "SmsDaemon.h"
10    #include "ConfigFile.h"
11    
12  using namespace std;  using namespace std;
13    
# Line 19  bool sms_exit(int exitcode) Line 20  bool sms_exit(int exitcode)
20          exit(exitcode);          exit(exitcode);
21  }  }
22    
23    
24  int main(int argc, char* argv[])  int main(int argc, char* argv[])
25  {  {
26          Common* cmn = Common::instance();          Common* cmn = Common::instance();
# Line 29  int main(int argc, char* argv[]) Line 31  int main(int argc, char* argv[])
31          cmn->pidfile = "/var/run/smsdaemon.pid";          cmn->pidfile = "/var/run/smsdaemon.pid";
32          cmn->spooldir = "/var/spool/smsdaemon";          cmn->spooldir = "/var/spool/smsdaemon";
33    
         cmn->uid = 1000;  
         cmn->gid = 1000;  
34    
35          cmn->loadConfig(argc,argv);          cmn->loadConfig(argc,argv);
36          cmn->daemonStart = time(0);          cmn->daemonStart = time(0);
37    
38            ConfigFile* config = cmn->GetConfigfile();
39            
40            bool res = config->Open( cmn->configFilePath ) ;
41            if (!res) {
42                    cmn->logMessage(string("Could not open config file:") + cmn->configFilePath);
43                    return 1;
44            }
45                    
46    
47          /////////////////////          /////////////////////
48                    
49          //Write a delimiter line in the logfile to seperate sessions          //Write a delimiter line in the logfile to seperate sessions
50    
51          if (Common::instance()->isDaemon)          if (Common::instance()->isDaemon)
52            {
53                    lookup_uid_values();
54                  daemonize();                  daemonize();
55            }
56    
57                    
58          SerialPort port("/dev/ttyS1" );          SerialPort port( config->GetValue("smsdaemon","serialport") );
59          try          try
60          {          {
61                  port.Open( SerialPort::BAUD_9600,                  port.Open( SerialPort::BAUD_9600,

Legend:
Removed from v.88  
changed lines
  Added in v.146

  ViewVC Help
Powered by ViewVC 1.1.20