src/server/daemon/webserver.c

changeset 22
adb0bda54e6b
parent 19
d680536f8c2f
child 28
f387669912e8
equal deleted inserted replaced
21:627b09ee74e4 22:adb0bda54e6b
59 if(cfgmgr_load_config() != 0) { 59 if(cfgmgr_load_config() != 0) {
60 fprintf(stderr, "Cannot load configuration\n"); 60 fprintf(stderr, "Cannot load configuration\n");
61 return -1; 61 return -1;
62 } 62 }
63 63
64 // create tmp dir and pid file
65 ServerConfiguration *cfg = cfgmgr_get_server_config();
66 char *mkdir_cmd = NULL;
67 asprintf(&mkdir_cmd, "mkdir -p %s", cfg->tmp.ptr);
68 system(mkdir_cmd);
69 free(mkdir_cmd);
70
71 char *pid_file_path = NULL;
72 asprintf(&pid_file_path, "%s/pid", cfg->tmp.ptr);
73 FILE *pidfile = fopen(pid_file_path, "w");
74 pid_t pid = getpid();
75 fprintf(pidfile, "%d", pid);
76 fclose(pidfile);
77 free(pid_file_path);
78
64 // init NSAPI functions 79 // init NSAPI functions
65 80
66 81
67 return 0; 82 return 0;
68 } 83 }

mercurial