server startup

svn path=/trunk/boinc/; revision=897
This commit is contained in:
David Anderson 2003-02-12 21:05:50 +00:00
parent 9e11a1e95c
commit a9dfdeeb0c
5 changed files with 47 additions and 57 deletions

View File

@ -3194,3 +3194,13 @@ David Feb 12 2003
scheduler_op.C
test/
test_time.php
David Feb 12 2003
- changed server startup mechanism so that config.xml contains
actual commands (so you can include cmdline args etc.)
sched/
config.C,h
start_servers.C
test/
test.inc

View File

@ -28,7 +28,8 @@
#include "config.h"
int CONFIG::parse(FILE* in) {
char buf[256];
char buf[256], cmd[256];
int ncmds = 0;
memset(this, 0, sizeof(CONFIG));
while (fgets(buf, 256, in)) {
@ -42,24 +43,8 @@ int CONFIG::parse(FILE* in) {
else if (parse_str(buf, "<upload_url>", upload_url, sizeof(upload_url))) continue;
else if (parse_str(buf, "<upload_dir>", upload_dir, sizeof(upload_dir))) continue;
else if (parse_str(buf, "<user_name>", user_name, sizeof(user_name))) continue;
else if (match_tag(buf, "<start_assimilator/>")) {
start_assimilator = true;
continue;
} else if (match_tag(buf, "<start_feeder/>")) {
start_feeder = true;
continue;
} else if (match_tag(buf, "<start_file_deleter/>")) {
start_file_deleter = true;
continue;
} else if (match_tag(buf, "<start_make_work/>")) {
start_make_work = true;
continue;
} else if (match_tag(buf, "<start_result_retry/>")) {
start_result_retry = true;
continue;
} else if (match_tag(buf, "<start_validate/>")) {
start_validate = true;
continue;
else if (parse_str(buf, "<start>", cmd, sizeof(cmd))) {
start_commands[ncmds++] = strdup(cmd);
}
}
return ERR_XML_PARSE;

View File

@ -33,12 +33,7 @@ public:
char upload_url[256];
char upload_dir[256];
char user_name[256];
bool start_assimilator;
bool start_feeder;
bool start_file_deleter;
bool start_make_work;
bool start_result_retry;
bool start_validate;
char* start_commands[20];
int parse(FILE*);
int parse_file();

View File

@ -25,6 +25,7 @@
int main() {
CONFIG config;
int retval;
char* p;
retval = config.parse_file();
if (retval) {
@ -32,22 +33,9 @@ int main() {
exit(1);
}
if (config.start_assimilator) {
system("assimilator >> assimilator.out 2>&1");
}
if (config.start_feeder) {
system("feeder >> feeder.out 2>&1");
}
if (config.start_file_deleter) {
system("file_deleter >> file_deleter.out 2>&1");
}
if (config.start_make_work) {
system("make_work >> make_work.out 2>&1");
}
if (config.start_result_retry) {
system("result_retry >> result_retry.out 2>&1");
}
if (config.start_validate) {
system("validate >> validate.out 2>&1");
for (i=0; i<20; i++) {
p = config.start_commands[i];
if (!p) break;
system(p);
}
}

View File

@ -314,21 +314,33 @@ class Project {
//
$f = fopen("$this->project_dir/cgi/config.xml", "w");
fputs($f, "<config>\n");
fputs($f, " <db_name>$this->db_name</db_name>\n");
fputs($f, " <db_passwd>$this->db_passwd</db_passwd>\n");
fputs($f, " <shmem_key>$this->shmem_key</shmem_key>\n");
fputs($f, " <key_dir>$this->key_dir</key_dir>\n");
fputs($f, " <download_url>$this->download_url</download_url>\n");
fputs($f, " <download_dir>$this->project_dir/download</download_dir>\n");
fputs($f, " <upload_url>$this->upload_url</upload_url>\n");
fputs($f, " <upload_dir>$this->project_dir/upload</upload_dir>\n");
fputs($f, " <user_name>$this->user_name</user_name>\n");
if ($this->start_assimilator) fputs($f, " <start_assimilator/>\n");
if ($this->start_feeder) fputs($f, " <start_assimilator/>\n");
if ($this->start_file_deleter) fputs($f, " <start_file_deleter/>\n");
if ($this->start_make_work) fputs($f, " <start_make_work/>\n");
if ($this->start_result_retry) fputs($f, " <start_result_retry/>\n");
if ($this->start_validate) fputs($f, " <start_validate/>\n");
fputs($f, "<db_name>$this->db_name</db_name>\n");
fputs($f, "<db_passwd>$this->db_passwd</db_passwd>\n");
fputs($f, "<shmem_key>$this->shmem_key</shmem_key>\n");
fputs($f, "<key_dir>$this->key_dir</key_dir>\n");
fputs($f, "<download_url>$this->download_url</download_url>\n");
fputs($f, "<download_dir>$this->project_dir/download</download_dir>\n");
fputs($f, "<upload_url>$this->upload_url</upload_url>\n");
fputs($f, "<upload_dir>$this->project_dir/upload</upload_dir>\n");
fputs($f, "<user_name>$this->user_name</user_name>\n");
if ($this->start_assimilator) {
fputs($f, "<start>assimilator >> assimilator.out 2>&1</start>\n");
}
if ($this->start_feeder) {
fputs($f, "<start>feeder >> feeder.out 2>&1</start>\n");
}
if ($this->start_file_deleter) {
fputs($f, "<start>file_deleter >> file_deleter.out 2>&1</start>\n");
}
if ($this->start_make_work) {
fputs($f, "<start>make_work >> make_work.out 2>&1</start>\n");
}
if ($this->start_result_retry) {
fputs($f, "<start>result_retry >> result_retry.out 2>&1</start>\n");
}
if ($this->start_validate) {
fputs($f, "<start>validate >> validate.out 2>&1</start>\n");
}
fputs($f, "</config>\n");
fclose($f);