20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
21 *****************************************************************************/ |
21 *****************************************************************************/ |
22 |
22 |
23 #include "bms.h" |
23 #include "bms.h" |
24 #include "xutil.h" |
24 #include "xutil.h" |
|
25 #include "futil.h" |
25 #include "rdconfig.h" |
26 #include "rdconfig.h" |
26 #include "lock.h" |
27 #include "lock.h" |
27 #include "mqtt.h" |
28 #include "mqtt.h" |
28 #include "mysql.h" |
29 #include "mysql.h" |
29 |
30 |
30 |
31 |
31 int my_shutdown = FALSE; |
32 int my_shutdown = FALSE; |
32 int debug = FALSE; |
33 int debug = FALSE; |
33 static pid_t pgrp, mypid; |
34 static pid_t pgrp, mypid; |
34 char *Private_Path = NULL; /* Users data path */ |
35 char *Private_Path = NULL; /* Users data path */ |
35 //char *resource_path = NULL; /* Webserver root */ |
36 |
36 |
37 extern sys_config Config; |
37 //extern struct lws_context *context; |
|
38 |
38 |
39 |
39 |
40 void help(void) |
40 void help(void) |
41 { |
41 { |
42 fprintf(stdout, "bmsd v%s starting\n\n", VERSION); |
42 fprintf(stdout, "bmsd v%s starting\n\n", VERSION); |
89 |
90 |
90 if (rdconfig()) { |
91 if (rdconfig()) { |
91 rc = 2; |
92 rc = 2; |
92 goto endit1; |
93 goto endit1; |
93 } |
94 } |
|
95 |
|
96 if (! Config.web_root) { |
|
97 rc = 5; |
|
98 syslog(LOG_NOTICE, "Configuration `web_root' is not set"); |
|
99 goto endit1; |
|
100 } |
|
101 |
|
102 /* |
|
103 * Make sure the needed log paths exist. |
|
104 */ |
|
105 tmppath = xstrcpy(Config.web_root); |
|
106 tmppath = xstrcat(tmppath, (char *)"/log/fermentation/"); |
|
107 if (! mkdirs(tmppath, 0755)) { |
|
108 rc = 5; |
|
109 goto endit1; |
|
110 } |
|
111 free(tmppath); |
|
112 tmppath = xstrcpy(Config.web_root); |
|
113 tmppath = xstrcat(tmppath, (char *)"/log/brews/"); |
|
114 if (! mkdirs(tmppath, 0755)) { |
|
115 rc = 5; |
|
116 goto endit1; |
|
117 } |
|
118 free(tmppath); |
|
119 tmppath = NULL; |
94 |
120 |
95 if (bms_mysql_init()) { |
121 if (bms_mysql_init()) { |
96 rc = 3; |
122 rc = 3; |
97 goto endit1; |
123 goto endit1; |
98 } |
124 } |