mirror of https://github.com/BOINC/boinc.git
- server programs: add --help and --version cmdline options to all.
From Nils Chr. Brause. svn path=/trunk/boinc/; revision=19079
This commit is contained in:
parent
317b76054c
commit
75d2a45491
10
Makefile.am
10
Makefile.am
|
@ -39,9 +39,17 @@ EXTRA_DIST = \
|
|||
|
||||
if INSTALL_HEADERS
|
||||
pkginclude_HEADERS = \
|
||||
version.h
|
||||
version.h \
|
||||
svn_version.h
|
||||
endif
|
||||
|
||||
# svn_version.h should always be rebuilt.
|
||||
|
||||
BUILT_SOURCES = svn_version.h
|
||||
svn_version.h: generate_svn_version.sh
|
||||
sh generate_svn_version.sh
|
||||
.PHONY: svn_version.h
|
||||
|
||||
# Add a stage target for staging a distribution
|
||||
|
||||
clean-generic:
|
||||
|
|
|
@ -7792,3 +7792,12 @@ David 17 Sept 2009
|
|||
|
||||
client/
|
||||
scheduler_op.cpp
|
||||
|
||||
David 17 Sept 2009
|
||||
- server programs: add --help and --version cmdline options to all.
|
||||
From Nils Chr. Brause.
|
||||
|
||||
Makefile.am
|
||||
generate_svn_version.sh
|
||||
sched/
|
||||
(most).cpp
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
echo "#ifndef SVN_VERSION_H" > svn_version.h
|
||||
echo "#define SVN_VERSION_H" >> svn_version.h
|
||||
echo "" >> svn_version.h
|
||||
|
||||
if [ -d .git ]; then
|
||||
CMD="git svn info"
|
||||
elif [ -d .svn ]; then
|
||||
CMD="svn info"
|
||||
else
|
||||
CMD=""
|
||||
fi
|
||||
|
||||
if [ "x$CMD" != "x" ]; then
|
||||
$CMD | awk '/^URL/ { url = $2; }; \
|
||||
/^Rev/ { rev = $2; }; \
|
||||
END { print "#define SVN_VERSION \"Repository: " url \
|
||||
" Revision: " rev "\""; };' \
|
||||
>> svn_version.h
|
||||
else
|
||||
echo "#include \"version.h\"" >> svn_version.h
|
||||
echo "#define SVN_VERSION BOINC_VERSION_STRING" >> svn_version.h
|
||||
fi
|
||||
|
||||
echo "" >> svn_version.h
|
||||
echo "#endif" >> svn_version.h
|
|
@ -28,8 +28,9 @@
|
|||
#include "sched_util.h"
|
||||
#include "sched_msgs.h"
|
||||
#include "hr_info.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
void usage(char** argv) {
|
||||
void usage(char *name) {
|
||||
fprintf(stderr,
|
||||
"This program scans the 'host' DB table and creates two files:\n\n"
|
||||
"%s: how much RAC each HR class is getting\n"
|
||||
|
@ -38,19 +39,33 @@ void usage(char** argv) {
|
|||
" (needed if you use the 'job_size_matching' scheduling option).\n\n"
|
||||
"This should be run as a periodic task (about once a day) from config.xml.\n"
|
||||
"For more info, see http://boinc.berkeley.edu/trac/wiki/HomogeneousRedundancy\n\n"
|
||||
"Usage: %s [--help]\n",
|
||||
HR_INFO_FILENAME, PERF_INFO_FILENAME, argv[0]
|
||||
"Usage: %s [OPTION]...\n\n"
|
||||
"Options:\n"
|
||||
" -h --help shows this help text.\n"
|
||||
" -v --version shows version information.\n",
|
||||
HR_INFO_FILENAME, PERF_INFO_FILENAME, name
|
||||
);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
HR_INFO hri;
|
||||
int retval;
|
||||
|
||||
for (int i=0; i<argc; i++) {
|
||||
for (int i=1; i<argc; i++) {
|
||||
if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
|
||||
usage(argv);
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
}
|
||||
else if(!strcmp(argv[i], "--version") || !strcmp(argv[i], "-v")) {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
}
|
||||
else {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"unknown command line argument: %s\n\n", argv[i]
|
||||
);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
check_stop_daemons();
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "error_numbers.h"
|
||||
#include "md5_file.h"
|
||||
#include "parse.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
#include "sched_config.h"
|
||||
#include "sched_util.h"
|
||||
|
@ -736,20 +737,20 @@ int ENUMERATION::make_it_happen(char* output_dir) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void usage(char** argv) {
|
||||
void usage(char* name) {
|
||||
fprintf(stderr,
|
||||
"This program generates XML files containing project statistics.\n"
|
||||
"It should be run once a day as a periodic task in config.xml.\n"
|
||||
"For more info, see http://boinc.berkeley.edu/trac/wiki/DbDump\n\n"
|
||||
"Usage: %s [options]\n"
|
||||
"Options:\n"
|
||||
" -dump_spec filename Use the given config file (use ../db_dump_spec.xml)\n"
|
||||
" [-d N] Set verbosity level (1, 2, 3=most verbose)\n"
|
||||
" [-db_host H] Use the DB server on host H\n"
|
||||
" [-h | --help] Show this\n",
|
||||
argv[0]
|
||||
" -dump_spec filename Use the given config file (use ../db_dump_spec.xml)\n"
|
||||
" [-d N] Set verbosity level (1, 2, 3=most verbose)\n"
|
||||
" [-db_host H] Use the DB server on host H\n"
|
||||
" [-h | -help | --help] Show this\n"
|
||||
" [-v | -version | --version] Show version information\n",
|
||||
name
|
||||
);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
@ -766,22 +767,43 @@ int main(int argc, char** argv) {
|
|||
strcpy(spec_filename, "");
|
||||
for (i=1; i<argc; i++) {
|
||||
if (!strcmp(argv[i], "-dump_spec")) {
|
||||
safe_strcpy(spec_filename, argv[++i]);
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
safe_strcpy(spec_filename, argv[i]);
|
||||
} else if (!strcmp(argv[i], "-d")) {
|
||||
log_messages.set_debug_level(atoi(argv[++i]));
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
log_messages.set_debug_level(atoi(argv[i]));
|
||||
} else if (!strcmp(argv[i], "-db_host")) {
|
||||
db_host = argv[++i];
|
||||
} else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
|
||||
usage(argv);
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
db_host = argv[i];
|
||||
} else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
} else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "-version") || !strcmp(argv[i], "--version")) {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else {
|
||||
log_messages.printf(MSG_CRITICAL, "Bad arg: %s\n", argv[i]);
|
||||
usage(argv);
|
||||
log_messages.printf(MSG_CRITICAL, "unknown command line argument: %s\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!strlen(spec_filename)) {
|
||||
log_messages.printf(MSG_CRITICAL, "no spec file given\n");
|
||||
usage(argv);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
FILE* f = fopen(spec_filename, "r");
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
#include "boinc_db.h"
|
||||
#include "util.h"
|
||||
#include "filesys.h"
|
||||
|
@ -50,6 +49,7 @@
|
|||
#include "sched_config.h"
|
||||
#include "sched_util.h"
|
||||
#include "sched_msgs.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
#include "error_numbers.h"
|
||||
#include "str_util.h"
|
||||
|
@ -554,22 +554,23 @@ bool do_pass() {
|
|||
}
|
||||
}
|
||||
|
||||
void usage(char** argv) {
|
||||
void usage(char* name) {
|
||||
fprintf(stderr,
|
||||
"Purge workunit and result records that are no longer needed.\n\n"
|
||||
"Usage: %s [options]\n"
|
||||
" [-d N] Set verbosity level (1, 2, 3=most verbose)\n"
|
||||
" [-min_age_days N] Purge Wus w/ mod time at least N days ago\n"
|
||||
" [-max N] Purge at more N WUs\n"
|
||||
" [-zip] Compuress output files using zip\n"
|
||||
" [-gzip] Compuress output files using gzip\n"
|
||||
" [-no_archive] Don't write output files, just purge\n"
|
||||
" [-max_wu_per_file N] Write at most N WUs per output file\n"
|
||||
" [-sleep N] Sleep N sec after DB scan\n"
|
||||
" [-one_pass] Make one DB scan, then exit\n",
|
||||
argv[0]
|
||||
" [-d N] Set verbosity level (1, 2, 3=most verbose)\n"
|
||||
" [-min_age_days N] Purge Wus w/ mod time at least N days ago\n"
|
||||
" [-max N] Purge at more N WUs\n"
|
||||
" [-zip] Compuress output files using zip\n"
|
||||
" [-gzip] uress output files using gzip\n"
|
||||
" [-no_archive] Don't write output files, just purge\n"
|
||||
" [-max_wu_per_file N] Write at most N WUs per output file\n"
|
||||
" [-sleep N] Sleep N sec after DB scan\n"
|
||||
" [-one_pass] Make one DB scan, then exit\n"
|
||||
" [-h | -help | --help] Show this help text\n"
|
||||
" [-v | -version | --version] Show version information\n",
|
||||
name
|
||||
);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
@ -583,35 +584,66 @@ int main(int argc, char** argv) {
|
|||
if (!strcmp(argv[i], "-one_pass")) {
|
||||
one_pass = true;
|
||||
} else if (!strcmp(argv[i], "-d")) {
|
||||
log_messages.set_debug_level(atoi(argv[++i]));
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
log_messages.set_debug_level(atoi(argv[i]));
|
||||
} else if (!strcmp(argv[i], "-min_age_days")) {
|
||||
min_age_days = atoi(argv[++i]);
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
min_age_days = atoi(argv[i]);
|
||||
} else if (!strcmp(argv[i], "-max")) {
|
||||
max_number_workunits_to_purge= atoi(argv[++i]);
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
max_number_workunits_to_purge= atoi(argv[i]);
|
||||
} else if (!strcmp(argv[i], "-zip")) {
|
||||
compression_type=COMPRESSION_ZIP;
|
||||
} else if (!strcmp(argv[i], "-gzip")) {
|
||||
compression_type=COMPRESSION_GZIP;
|
||||
} else if (!strcmp(argv[i], "-max_wu_per_file")) {
|
||||
max_wu_per_file = atoi(argv[++i]);
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
max_wu_per_file = atoi(argv[i]);
|
||||
} else if (!strcmp(argv[i], "-no_archive")) {
|
||||
no_archive = true;
|
||||
} else if (!strcmp(argv[i], "-sleep")) {
|
||||
sleep_sec = atoi(argv[++i]);
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
sleep_sec = atoi(argv[i]);
|
||||
if (sleep_sec < 1 || sleep_sec > 86400) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"Unreasonable value of sleep interval: %d seconds\n",
|
||||
sleep_sec
|
||||
);
|
||||
usage(argv);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
} else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
|
||||
usage(argv);
|
||||
} else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-help") || !strcmp(argv[i], "-h")) {
|
||||
usage(argv[0]);
|
||||
return 0;
|
||||
} else if (!strcmp(argv[i], "--version") || !strcmp(argv[i], "-version")) {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"Unrecognized arg: %s\n", argv[i]
|
||||
"unknown command line argument: %s\n\n", argv[i]
|
||||
);
|
||||
usage(argv);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,20 +31,26 @@
|
|||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include "boinc_db.h"
|
||||
#include "str_util.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
#include "sched_config.h"
|
||||
#include "sched_util.h"
|
||||
|
||||
void usage(char** argv) {
|
||||
void usage(char* name) {
|
||||
fprintf(stderr,
|
||||
"Arrange to delete a file from a host.\n\n"
|
||||
"Usage: %s -host_id H -file_name F\n",
|
||||
argv[0]
|
||||
"Usage: %s OPTION...\n\n"
|
||||
"Options:\n"
|
||||
" -file_name F Specify te file to delete.\n"
|
||||
" -host_id H Specify the coresponding host\n"
|
||||
" [-h | -help | --help] Show this help text.\n"
|
||||
" [-v | -version | --version] Show version information.\n",
|
||||
name
|
||||
);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int delete_host_file(int host_id, const char* file_name) {
|
||||
|
@ -76,20 +82,35 @@ int main(int argc, char** argv) {
|
|||
|
||||
for (i=1; i<argc; i++) {
|
||||
if (!strcmp(argv[i], "-host_id")) {
|
||||
host_id = atoi(argv[++i]);
|
||||
if(!argv[++i]) {
|
||||
fprintf(stderr, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
host_id = atoi(argv[i]);
|
||||
} else if(!strcmp(argv[i], "-file_name")) {
|
||||
strcpy(file_name, argv[++i]);
|
||||
} else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
|
||||
usage(argv);
|
||||
if(!argv[++i]) {
|
||||
fprintf(stderr, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
strcpy(file_name, argv[i]);
|
||||
} else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-help") || !strcmp(argv[i], "-h")) {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
} else if (!strcmp(argv[i], "--version") || !strcmp(argv[i], "-version") || !strcmp(argv[i], "-v")) {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else {
|
||||
fprintf(stderr, "bad arg %s\n", argv[i]);
|
||||
usage(argv);
|
||||
fprintf(stderr, "unknown command line argument: %s\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!strlen(file_name) || host_id == 0) {
|
||||
usage(argv);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
retval = config.parse_file();
|
||||
|
|
114
sched/feeder.cpp
114
sched/feeder.cpp
|
@ -110,6 +110,7 @@ using std::vector;
|
|||
#include "synch.h"
|
||||
#include "util.h"
|
||||
#include "str_util.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
#include "sched_config.h"
|
||||
#include "sched_shmem.h"
|
||||
|
@ -623,10 +624,45 @@ void show_state(int) {
|
|||
}
|
||||
|
||||
void show_version() {
|
||||
log_messages.printf(MSG_NORMAL,"Version %d.%d.%d\n",
|
||||
BOINC_MAJOR_VERSION,
|
||||
BOINC_MINOR_VERSION,
|
||||
BOINC_RELEASE
|
||||
log_messages.printf(MSG_NORMAL, "%s\n", SVN_VERSION);
|
||||
}
|
||||
|
||||
void usage(char *name)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s creates a shared memory segment containing DB info,\n"
|
||||
"including an array of work items (results/workunits to send).\n\n"
|
||||
"Usage: %s [OPTION]...\n\n"
|
||||
"Options:\n"
|
||||
" [ -d X ] "
|
||||
"Set Debug level to X\n"
|
||||
" [ -allapps ] "
|
||||
"Interleave results from all applications uniformly.\n"
|
||||
" [ -random_order ] "
|
||||
"order by \"random\" field of result\n"
|
||||
" [ -priority_order ] "
|
||||
"order by decreasing \"priority\" field of result\n"
|
||||
" [ -priority_order_create_time ] "
|
||||
"order by priority, then by increasing WU create time\n"
|
||||
" [ -purge_stale ] "
|
||||
"remove work items from the shared memory segment\n"
|
||||
" "
|
||||
"that have been there for longer then x minutes\n"
|
||||
" "
|
||||
"but haven't been assigned\n"
|
||||
" [ -appids a1{,a2} ] "
|
||||
"get work only for appids a1,... (comma-separated list)\n"
|
||||
" [ -mod n i ] "
|
||||
"handle only results with (id mod n) == i\n"
|
||||
" [ -wmod n i ] "
|
||||
"handle only workunits with (id mod n) == i\n"
|
||||
" [ -sleep_interval x ] "
|
||||
"sleep x seconds if nothing to do\n"
|
||||
" [ -h | -help | --help ] "
|
||||
"Shows this help text.\n"
|
||||
" [ -v | -version | --verison ] "
|
||||
"Shows version information.\n",
|
||||
name, name
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -636,23 +672,14 @@ int main(int argc, char** argv) {
|
|||
char path[256];
|
||||
char* appids=NULL;
|
||||
|
||||
retval = config.parse_file();
|
||||
if (retval) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"Can't parse config.xml: %s\n", boincerror(retval)
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
unlink(config.project_path(REREAD_DB_FILENAME));
|
||||
|
||||
if (argc == 2 && !strcmp(argv[1], "--version")) {
|
||||
show_version();
|
||||
exit(0);
|
||||
}
|
||||
for (i=1; i<argc; i++) {
|
||||
if (!strcmp(argv[i], "-d")) {
|
||||
log_messages.set_debug_level(atoi(argv[++i]));
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
log_messages.set_debug_level(atoi(argv[i]));
|
||||
} else if (!strcmp(argv[i], "-random_order")) {
|
||||
order_clause = "order by r1.random ";
|
||||
} else if (!strcmp(argv[i], "-allapps")) {
|
||||
|
@ -664,27 +691,62 @@ int main(int argc, char** argv) {
|
|||
} else if (!strcmp(argv[i], "-purge_stale")) {
|
||||
purge_stale_time = atoi(argv[++i])*60;
|
||||
} else if (!strcmp(argv[i], "-appids")) {
|
||||
strcat(mod_select_clause, " and workunit.appid in (");
|
||||
strcat(mod_select_clause, argv[++i]);
|
||||
strcat(mod_select_clause, ")");
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
strcat(mod_select_clause, " and workunit.appid in (");
|
||||
strcat(mod_select_clause, argv[i]);
|
||||
strcat(mod_select_clause, ")");
|
||||
} else if (!strcmp(argv[i], "-mod")) {
|
||||
if(!argv[i+1] || !argv[i+2]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires two arguments\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
int n = atoi(argv[++i]);
|
||||
int j = atoi(argv[++i]);
|
||||
sprintf(mod_select_clause, "and r1.id %% %d = %d ", n, j);
|
||||
} else if (!strcmp(argv[i], "-wmod")) {
|
||||
if(!argv[i+1] || !argv[i+2]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires two arguments\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
int n = atoi(argv[++i]);
|
||||
int j = atoi(argv[++i]);
|
||||
sprintf(mod_select_clause, "and workunit.id %% %d = %d ", n, j);
|
||||
} else if (!strcmp(argv[i], "-sleep_interval")) {
|
||||
sleep_interval = atof(argv[++i]);
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
sleep_interval = atof(argv[i]);
|
||||
} else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "-version") || !strcmp(argv[i], "--version")) {
|
||||
show_version();
|
||||
exit(0);
|
||||
} else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
} else {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"bad cmdline arg: %s\n", argv[i]
|
||||
);
|
||||
log_messages.printf(MSG_CRITICAL, "unknown command line argument: %s\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
retval = config.parse_file();
|
||||
if (retval) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"Can't parse config.xml: %s\n", boincerror(retval)
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
unlink(config.project_path(REREAD_DB_FILENAME));
|
||||
|
||||
log_messages.printf(MSG_NORMAL, "Starting\n");
|
||||
show_version();
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include "str_replace.h"
|
||||
#include "filesys.h"
|
||||
#include "strings.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
#include "sched_config.h"
|
||||
#include "sched_util.h"
|
||||
|
@ -77,53 +78,40 @@ bool do_input_files = true;
|
|||
bool do_output_files = true;
|
||||
int sleep_interval = DEFAULT_SLEEP_INTERVAL;
|
||||
|
||||
void usage() {
|
||||
fprintf(stderr,
|
||||
"file_deleter: deletes files that are no longer needed.\n"
|
||||
"\n"
|
||||
"default operation:\n"
|
||||
"1) enumerate N WUs and M results (N,M compile params)\n"
|
||||
" that are ready to file-delete, and try to delete their files\n"
|
||||
"2) if the enums didn't yield anything, sleep for K seconds\n"
|
||||
"3) repeat from 1)\n"
|
||||
"4) every 1 hour, enumerate everything in state FILE_DELETE_ERROR\n"
|
||||
" and try to delete it.\n"
|
||||
"5) after 1 hour, and every 24 hours thereafter,\n"
|
||||
" scan for and delete all files in the upload directories\n"
|
||||
" that are older than any WU in the database,\n"
|
||||
" and were created at least one month ago.\n"
|
||||
" This deletes files uploaded by hosts after the WU was deleted.\n"
|
||||
"\n"
|
||||
"options:\n"
|
||||
"\n"
|
||||
"-d N\n"
|
||||
" set debug output level (1/2/3)\n"
|
||||
"-mod M R\n"
|
||||
" handle only WUs with ID mod M == R\n"
|
||||
"-appid ID\n"
|
||||
" handle only WUs of a particular app\n"
|
||||
"-one_pass\n"
|
||||
" instead of sleeping in 2), exit\n"
|
||||
"-delete_antiques_now\n"
|
||||
" do 5) immediately\n"
|
||||
"-dont_retry_error\n"
|
||||
" don't do 4)\n"
|
||||
"-dont_delete_antiques\n"
|
||||
" don't do 5)\n"
|
||||
"-preserve_result_files\n"
|
||||
" update the DB, but don't delete output files.\n"
|
||||
" For debugging.\n"
|
||||
"-preserve_wu_files\n"
|
||||
" update the DB, but don't delete input files.\n"
|
||||
" For debugging.\n"
|
||||
"-dont_delete_batches\n"
|
||||
" don't delete anything with positive batch number\n"
|
||||
"-input_files_only\n"
|
||||
" delete only input (download) files\n"
|
||||
"-output_files_only\n"
|
||||
" delete only output (upload) files\n"
|
||||
void usage(char *name) {
|
||||
fprintf(stderr, "Deletes files that are no longer needed.\n\n"
|
||||
"Default operation:\n"
|
||||
"1) enumerate N WUs and M results (N,M compile params)\n"
|
||||
" that are ready to file-delete, and try to delete their files\n"
|
||||
"2) if the enums didn't yield anything, sleep for K seconds\n"
|
||||
"3) repeat from 1)\n"
|
||||
"4) every 1 hour, enumerate everything in state FILE_DELETE_ERROR\n"
|
||||
" and try to delete it.\n"
|
||||
"5) after 1 hour, and every 24 hours thereafter,\n"
|
||||
" scan for and delete all files in the upload directories\n"
|
||||
" that are older than any WU in the database,\n"
|
||||
" and were created at least one month ago.\n"
|
||||
" This deletes files uploaded by hosts after the WU was deleted.\n\n"
|
||||
"Usage: %s [OPTION]...\n\n"
|
||||
"Options:\n"
|
||||
" -d N set debug output level (1/2/3)\n"
|
||||
" -mod M R handle only WUs with ID mod M == R\n"
|
||||
" -appid ID handle only WUs of a particular app\n"
|
||||
" -one_pass instead of sleeping in 2), exit\n"
|
||||
" -delete_antiques_now do 5) immediately\n"
|
||||
" -dont_retry_error don't do 4)\n"
|
||||
" -dont_delete_antiques don't do 5)\n"
|
||||
" -preserve_result_files update the DB, but don't delete output files.\n"
|
||||
" For debugging.\n"
|
||||
" -preserve_wu_files update the DB, but don't delete input files.\n"
|
||||
" For debugging.\n"
|
||||
" -dont_delete_batches don't delete anything with positive batch number\n"
|
||||
" -input_files_only delete only input (download) files\n"
|
||||
" -output_files_only delete only output (upload) files\n"
|
||||
" [ -h | -help | --help ] shows this help text\n"
|
||||
" [ -v | -version | --version ] shows version information\n",
|
||||
name
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Given a filename, find its full path in the upload directory hierarchy
|
||||
|
@ -645,10 +633,25 @@ int main(int argc, char** argv) {
|
|||
} else if (!strcmp(argv[i], "-preserve_result_files")) {
|
||||
preserve_result_files = true;
|
||||
} else if (!strcmp(argv[i], "-appid")) {
|
||||
appid = atoi(argv[++i]);
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
appid = atoi(argv[i]);
|
||||
} else if (!strcmp(argv[i], "-d")) {
|
||||
log_messages.set_debug_level(atoi(argv[++i]));
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
log_messages.set_debug_level(atoi(argv[i]));
|
||||
} else if (!strcmp(argv[i], "-mod")) {
|
||||
if(!argv[i+1] || !argv[i+2]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires two arguments\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
id_modulus = atoi(argv[++i]);
|
||||
id_remainder = atoi(argv[++i]);
|
||||
} else if (!strcmp(argv[i], "-dont_delete_antiques")) {
|
||||
|
@ -663,14 +666,22 @@ int main(int argc, char** argv) {
|
|||
} else if (!strcmp(argv[i], "-output_files_only")) {
|
||||
do_input_files = false;
|
||||
} else if (!strcmp(argv[i], "-sleep_interval")) {
|
||||
sleep_interval = atoi(argv[++i]);
|
||||
} else if (!strcmp(argv[i], "-help")) {
|
||||
usage();
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
sleep_interval = atoi(argv[i]);
|
||||
} else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
} else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "-version") || !strcmp(argv[i], "--version")) {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"Unrecognized arg: %s\n", argv[i]
|
||||
);
|
||||
usage();
|
||||
log_messages.printf(MSG_CRITICAL, "unknown command line argument: %s\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <unistd.h>
|
||||
#include <csignal>
|
||||
#include <fcntl.h>
|
||||
#include <string>
|
||||
|
||||
#ifdef _USING_FCGI_
|
||||
#include "boinc_fcgi.h"
|
||||
|
@ -42,6 +43,7 @@
|
|||
#include "error_numbers.h"
|
||||
#include "str_util.h"
|
||||
#include "filesys.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
#include "sched_config.h"
|
||||
#include "sched_util.h"
|
||||
|
@ -611,7 +613,20 @@ void installer() {
|
|||
signal(SIGTERM, boinc_catch_signal); // terminate process
|
||||
}
|
||||
|
||||
int main() {
|
||||
void usage(char *name) {
|
||||
fprintf(stderr,
|
||||
"This is the boinc file upload handler.\n"
|
||||
"It receives the results from the clients\n"
|
||||
"and puts them on the file server.\n\n"
|
||||
"Usage: %s [OPTION]...\n\n"
|
||||
"Options:\n"
|
||||
" [ -h | -help | --help ] Show this help text.\n"
|
||||
" [ -v | -version | --version ] Show version information.\n",
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int retval;
|
||||
R_RSA_PUBLIC_KEY key;
|
||||
char log_path[256];
|
||||
|
@ -619,6 +634,21 @@ int main() {
|
|||
unsigned int counter=0;
|
||||
#endif
|
||||
|
||||
for(int c = 1; c < argc; c++) {
|
||||
std::string option(argv[c]);
|
||||
if(option == "-v" || option == "-version" || option == "--version") {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else if(option == "-h" || option == "-help" || option == "--help") {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
} else {
|
||||
fprintf(stderr, "unknown command line argument: %s\n\n", argv[c]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
installer();
|
||||
|
||||
get_log_path(log_path, "file_upload_handler.log");
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "sched_config.h"
|
||||
#include "sched_util.h"
|
||||
#include "md5_file.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
void init_xfer_result(DB_RESULT& result) {
|
||||
result.id = 0;
|
||||
|
@ -139,6 +140,22 @@ int get_file(int host_id, const char* file_name) {
|
|||
return retval;
|
||||
}
|
||||
|
||||
void usage(char *name) {
|
||||
fprintf(stderr, "Gets a file to a specific host.\n"
|
||||
"Creates a result entry, initialized to sent, and corresponding\n"
|
||||
"messages to the host that is assumed to have the file.\n"
|
||||
"Run from the project root dir.\n\n"
|
||||
"Usage: %s [OPTION]...\n\n"
|
||||
"Options:\n"
|
||||
" -host_id id "
|
||||
"Specify numerical id of host to upload from.\n"
|
||||
" -file_name name "
|
||||
"Specify name of specific file, dominates workunit.\n"
|
||||
" [ -v | -version | --version ] Show version information.\n"
|
||||
" [ -h | -help | --help ] Show this help text.\n",
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int i, retval;
|
||||
|
@ -152,23 +169,29 @@ int main(int argc, char** argv) {
|
|||
|
||||
for(i=1; i<argc; i++) {
|
||||
if (!strcmp(argv[i], "-host_id")) {
|
||||
host_id = atoi(argv[++i]);
|
||||
} else if (!strcmp(argv[i], "-file_name")) {
|
||||
strcpy(file_name, argv[++i]);
|
||||
} else if (!strcmp(argv[i], "-help")) {
|
||||
fprintf(stdout,
|
||||
"get_file: gets a file to a specific host\n\n"
|
||||
"It takes the following arguments and types:\n"
|
||||
"-hostid (int); the number of the host\n"
|
||||
"-file_name (string); the name of the file to get\n"
|
||||
);
|
||||
exit(0);
|
||||
} else {
|
||||
if (!strncmp("-",argv[i],1)) {
|
||||
fprintf(stderr, "get_file: bad argument '%s'\n", argv[i]);
|
||||
fprintf(stderr, "type get_file -help for more information\n");
|
||||
if(!argv[++i]) {
|
||||
fprintf(stderr, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
host_id = atoi(argv[i]);
|
||||
} else if (!strcmp(argv[i], "-file_name")) {
|
||||
if(!argv[++i]) {
|
||||
fprintf(stderr, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
strcpy(file_name, argv[i]);
|
||||
} else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
} else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "-version") || !strcmp(argv[i], "--version")) {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else {
|
||||
fprintf(stderr, "unknown command line argument: %s\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ using std::string;
|
|||
#include "sched_util.h"
|
||||
#include "sched_msgs.h"
|
||||
#include "str_util.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
#define LOCKFILE "make_work.out"
|
||||
#define PIDFILE "make_work.pid"
|
||||
|
@ -265,25 +266,72 @@ void make_work(vector<string> &wu_names) {
|
|||
}
|
||||
}
|
||||
|
||||
void usage(char *name) {
|
||||
fprintf(stderr,
|
||||
"Create WU and result records as needed to maintain a pool of work\n"
|
||||
"(for testing purposes).\n"
|
||||
"Clones the WU of the given name.\n\n"
|
||||
"Usage: %s [OPTION]...\n\n"
|
||||
"Options:\n"
|
||||
" -wu_name name the name for the WU\n"
|
||||
" (can be repeated)\n"
|
||||
" [ -cushion N ] "
|
||||
"make work if fewer than N unsent results\n"
|
||||
" [ -max_wus n ] "
|
||||
"don't make work if more than N total WUs\n"
|
||||
" [ -one_pass ] quit after one pass\n"
|
||||
" [ -d X ] set debug level to X.\n"
|
||||
" [ -h | -help | --help ] shows this help text.\n"
|
||||
" [ -v | -version | --version ] shows version information\n",
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int i;
|
||||
vector<string> wu_names;
|
||||
|
||||
for (i=1; i<argc; i++) {
|
||||
if (!strcmp(argv[i], "-cushion")) {
|
||||
cushion = atoi(argv[++i]);
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
cushion = atoi(argv[i]);
|
||||
} else if (!strcmp(argv[i], "-d")) {
|
||||
log_messages.set_debug_level(atoi(argv[++i]));
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
log_messages.set_debug_level(atoi(argv[i]));
|
||||
} else if (!strcmp(argv[i], "-wu_name")) {
|
||||
wu_names.push_back(string(argv[++i]));
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
wu_names.push_back(string(argv[i]));
|
||||
} else if (!strcmp(argv[i], "-max_wus")) {
|
||||
max_wus = atoi(argv[++i]);
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
max_wus = atoi(argv[i]);
|
||||
} else if (!strcmp(argv[i], "-one_pass")) {
|
||||
one_pass = true;
|
||||
} else if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "-help") || !strcmp(argv[1], "--help")) {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
} else if (!strcmp(argv[1], "-v") || !strcmp(argv[1], "-version") || !strcmp(argv[1], "--version")) {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else {
|
||||
log_messages.printf(
|
||||
MSG_CRITICAL, "unknown argument: %s\n", argv[i]
|
||||
);
|
||||
log_messages.printf(MSG_CRITICAL, "unknown command line argument: %s\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
check_stop_daemons();
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "util.h"
|
||||
#include "error_numbers.h"
|
||||
#include "str_util.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
#include "sched_config.h"
|
||||
#include "sched_util.h"
|
||||
|
@ -47,10 +48,7 @@ extern int handle_message(MSG_FROM_HOST&);
|
|||
int handle_message(MSG_FROM_HOST& mfh) {
|
||||
int retval;
|
||||
|
||||
printf(
|
||||
"got message \n%s\n",
|
||||
mfh.xml
|
||||
);
|
||||
printf("got message \n%s\n", mfh.xml);
|
||||
DB_MSG_TO_HOST mth;
|
||||
mth.clear();
|
||||
mth.create_time = time(0);
|
||||
|
@ -128,6 +126,19 @@ int main_loop(bool one_pass) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void usage(char *name) {
|
||||
fprintf(stderr,
|
||||
"check and validate new messages\n\n"
|
||||
"Usage: %s [OPTION]...\n\n"
|
||||
"Options:\n"
|
||||
" [ -d X ] Set debug level to X\n"
|
||||
" [ -one_pass ] "
|
||||
"make one pass through table, then exit\n"
|
||||
" [ -h | -help | --help ] show this help text.\n"
|
||||
" [ -v | -version | --version ] show version informaation\n",
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int i, retval;
|
||||
|
@ -139,11 +150,22 @@ int main(int argc, char** argv) {
|
|||
if (!strcmp(argv[i], "-one_pass")) {
|
||||
one_pass = true;
|
||||
} else if (!strcmp(argv[i], "-d")) {
|
||||
log_messages.set_debug_level(atoi(argv[++i]));
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
log_messages.set_debug_level(atoi(argv[i]));
|
||||
} else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
} else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "-version") || !strcmp(argv[i], "--version")) {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"unrecognized arg: %s\n", argv[i]
|
||||
);
|
||||
log_messages.printf(MSG_CRITICAL, "unknown command line argument: %s\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "boinc_db.h"
|
||||
#include "str_util.h"
|
||||
#include "error_numbers.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
#include "sched_config.h"
|
||||
#include "sched_util.h"
|
||||
|
@ -71,6 +72,22 @@ int request_files_from_all() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void usage(char *name) {
|
||||
fprintf(stderr,
|
||||
"Create a msg_to_host_that requests the list of permanant files\n"
|
||||
"associated with the project\n"
|
||||
"Run this in the project root dir\n\n"
|
||||
"Usage: %s [OPTION]...\n\n"
|
||||
"Options:\n"
|
||||
" -host_id number of host to upload from\n"
|
||||
" "
|
||||
"or 'all' or '0' if for all active hosts\n"
|
||||
" [ -v | -version | --version ] show version information\n"
|
||||
" [ -h | -help | --help ] show this help text\n",
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int i, retval;
|
||||
int host_id;
|
||||
|
@ -79,20 +96,28 @@ int main(int argc, char** argv) {
|
|||
|
||||
check_stop_daemons();
|
||||
|
||||
for(i=1; i<argc; i++) {
|
||||
for (i=1; i<argc; i++) {
|
||||
if (!strcmp(argv[i], "-host_id")) {
|
||||
if (!strcmp(argv[++i], "all")) {
|
||||
if(!argv[++i]) {
|
||||
fprintf(stderr, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
if (!strcmp(argv[i], "all")) {
|
||||
host_id = 0;
|
||||
} else {
|
||||
host_id = atoi(argv[i]);
|
||||
}
|
||||
} else if(!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
} else if(!strcmp(argv[i], "-v") || !strcmp(argv[i], "-version") || !strcmp(argv[i], "--version")) {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else {
|
||||
if (!strncmp("-",argv[i],1)) {
|
||||
fprintf(stderr,
|
||||
"request_file_list: bad argument '%s'\n", argv[i]
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
fprintf(stderr, "unknown command line argument: %s\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// sample_work_generator.C: an example BOINC work generator.
|
||||
// sample_work_generator.cpp: an example BOINC work generator.
|
||||
// This work generator has the following properties
|
||||
// (you may need to change some or all of these):
|
||||
//
|
||||
|
@ -37,6 +37,7 @@
|
|||
#include "backend_lib.h"
|
||||
#include "parse.h"
|
||||
#include "util.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
#include "sched_config.h"
|
||||
#include "sched_util.h"
|
||||
|
@ -137,16 +138,47 @@ void main_loop() {
|
|||
}
|
||||
}
|
||||
|
||||
void usage(char *name) {
|
||||
fprintf(stderr, "This is an example BOINC work generator.\n"
|
||||
"This work generator has the following properties\n"
|
||||
"(you may need to change some or all of these):\n"
|
||||
"- Runs as a daemon, and creates an unbounded supply of work.\n"
|
||||
" It attempts to maintain a \"cushion\" of 100 unsent job instances.\n"
|
||||
" (your app may not work this way; e.g. you might create work in batches)\n"
|
||||
"- Creates work for the application \"uppercase\".\n"
|
||||
"- Creates a new input file for each job;\n"
|
||||
" the file (and the workunit names) contain a timestamp\n"
|
||||
" and sequence number, so that they're unique.\n\n"
|
||||
"Usage: %s [OPTION]...\n\n"
|
||||
"Options:\n"
|
||||
" [ -d X ] Sets debug level to X.\n"
|
||||
" [ -h | -help | --help ] Shows this help text.\n"
|
||||
" [ -v | --version | --version ] Shows version information.\n",
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int i, retval;
|
||||
|
||||
for (i=1; i<argc; i++) {
|
||||
if (!strcmp(argv[i], "-d")) {
|
||||
log_messages.set_debug_level(atoi(argv[++i]));
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
log_messages.set_debug_level(atoi(argv[i]));
|
||||
} else if(!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
} else if(!strcmp(argv[i], "-v") || !strcmp(argv[i], "-version") || !strcmp(argv[i], "--version")) {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"bad cmdline arg: %s", argv[i]
|
||||
);
|
||||
log_messages.printf(MSG_CRITICAL, "unknown command line argument: %s\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include <cstdio>
|
||||
#include <vector>
|
||||
#include "util.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
using std::vector;
|
||||
|
||||
|
@ -117,17 +118,63 @@ void make_request(int i) {
|
|||
);
|
||||
}
|
||||
|
||||
void usage(char *name) {
|
||||
fprintf(stderr,
|
||||
"This program generates a stream of scheduler requests;\n"
|
||||
"it acts as a \"driver\" for the scheduler when used as:\n"
|
||||
"%s | cgi --batch --mark_jobs_done\n\n"
|
||||
"This was written to test the homogeneous redundancy features\n"
|
||||
"of the feeder and scheduler,\n"
|
||||
"but it could be used for a variety of other purposes.\n\n"
|
||||
"Each request asks for a uniformly-distributed random amount of work.\n"
|
||||
"The OS and CPU info is taken from the successive lines of a file of the form\n"
|
||||
"| os_name | p_vendor | p_model |\n"
|
||||
"Generate this file with a SQL query, trimming off the start and end.\n\n"
|
||||
"Notes:\n"
|
||||
"1) Use sample_trivial_validator and sample_dummy_assimilator\n"
|
||||
"2) Edit the following to something in your DB\n\n"
|
||||
"Usage: %s [OPTION]...\n\n"
|
||||
"Options: \n"
|
||||
" --nrequests N Sets the total nukmer of requests to N\n"
|
||||
" --reqs_per_second X Sets the number of requests per second to X\n"
|
||||
" [ -h | -help | --help ] Show this help text.\n"
|
||||
" [ -v | -version | --version ] Show version information\n",
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int i, nrequests = 1;
|
||||
double reqs_per_second = 1;
|
||||
|
||||
for (i=1; i<argc; i++) {
|
||||
if (!strcmp(argv[i], "--nrequests")) {
|
||||
nrequests = atoi(argv[++i]);
|
||||
continue;
|
||||
if(!argv[++i]) {
|
||||
fprintf(stderr, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
nrequests = atoi(argv[i]);
|
||||
}
|
||||
if (!strcmp(argv[i], "--reqs_per_second")) {
|
||||
reqs_per_second = atof(argv[++i]);
|
||||
else if (!strcmp(argv[i], "--reqs_per_second")) {
|
||||
if(!argv[++i]) {
|
||||
fprintf(stderr, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
reqs_per_second = atof(argv[i]);
|
||||
}
|
||||
else if(!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
}
|
||||
else if(!strcmp(argv[i], "-v") || !strcmp(argv[i], "-version") || !strcmp(argv[i], "--version")) {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else {
|
||||
fprintf(stderr, "unknown command line argument: %s\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
read_hosts();
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "util.h"
|
||||
#include "str_util.h"
|
||||
#include "synch.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
#include "sched_config.h"
|
||||
#include "sched_types.h"
|
||||
|
@ -84,18 +85,19 @@ bool all_apps_use_hr;
|
|||
|
||||
static void usage(char* p) {
|
||||
fprintf(stderr,
|
||||
"usage: %s [options]\n"
|
||||
"\n"
|
||||
"--batch stdin contains a sequence of request messages.\n"
|
||||
" Do them all, and ignore rpc_seqno.\n"
|
||||
"--mark_jobs_done When send a job, also mark it as done.\n"
|
||||
" (for performance testing)\n"
|
||||
"--debug_log Write messages to the file 'debug_log'\n"
|
||||
"--simulator X Start with simulated time X\n"
|
||||
" (only if compiled with GCL_SIMULATOR)\n",
|
||||
"Usage: %s [OPTION]...\n\n"
|
||||
"Options:\n"
|
||||
" --batch stdin contains a sequence of request messages.\n"
|
||||
" Do them all, and ignore rpc_seqno.\n"
|
||||
" --mark_jobs_done When send a job, also mark it as done.\n"
|
||||
" (for performance testing)\n"
|
||||
" --debug_log Write messages to the file 'debug_log'\n"
|
||||
" --simulator X Start with simulated time X\n"
|
||||
" (only if compiled with GCL_SIMULATOR)\n"
|
||||
" -h | --help Show this help text\n"
|
||||
" -v | --version Show version information\n",
|
||||
p
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void debug_sched(const char *trigger) {
|
||||
|
@ -363,10 +365,23 @@ int main(int argc, char** argv) {
|
|||
debug_log = true;
|
||||
#ifdef GCL_SIMULATOR
|
||||
} else if (!strcmp(argv[i], "--simulator")) {
|
||||
simtime = atof(argv[++i]);
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
simtime = atof(argv[i]);
|
||||
#endif
|
||||
} else {
|
||||
} else if(!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
} else if(!strcmp(argv[1], "-v") || !strcmp(argv[1], "--version")) {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else {
|
||||
log_messages.printf(MSG_CRITICAL, "unknown command line argument: %s\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
//------------------------------------
|
||||
//
|
||||
// send_file [-host_id host_id] [-file_name file_name] [-num_copies]
|
||||
// send_file [-host_id host_id] [-file_name file_name]
|
||||
// -host_id name of host to upload from
|
||||
// -file_name name of specific file, dominates workunit
|
||||
//
|
||||
|
@ -36,6 +36,7 @@
|
|||
#include "util.h"
|
||||
#include "str_util.h"
|
||||
#include "md5_file.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
#include "sched_config.h"
|
||||
#include "sched_util.h"
|
||||
|
@ -152,39 +153,57 @@ int send_file(int host_id, const char* file_name) {
|
|||
}
|
||||
|
||||
|
||||
void usage(char *name) {
|
||||
fprintf(stderr,
|
||||
"Create a result entries, initialized to sent, and corresponding\n"
|
||||
"messages to the get the files.\n\n"
|
||||
"Usage: %s [OPTION]...\n\n"
|
||||
"Options:\n"
|
||||
" -host_id id id of host to upload from\n"
|
||||
" -file_name name name of specific file, dominates workunit\n"
|
||||
" [ -h | -help | --help ] Show this help text.\n"
|
||||
" [ -v | -version | --version ] Show version information.\n",
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int i, retval;
|
||||
char file_name[256];
|
||||
int host_id;
|
||||
int num_copies;
|
||||
|
||||
// initialize argument strings to empty
|
||||
strcpy(file_name, "");
|
||||
host_id = 0;
|
||||
num_copies = 0;
|
||||
|
||||
check_stop_daemons();
|
||||
|
||||
// get arguments
|
||||
for(i=1; i<argc; i++) {
|
||||
for (i=1; i<argc; i++) {
|
||||
if (!strcmp(argv[i], "-host_id")) {
|
||||
host_id = atoi(argv[++i]);
|
||||
} else if (!strcmp(argv[i], "-file_name")) {
|
||||
strcpy(file_name, argv[++i]);
|
||||
} else if (!strcmp(argv[i], "-help")) {
|
||||
fprintf(stdout,
|
||||
"send_file: sends a file to a specific host\n\n"
|
||||
"It takes the following arguments and types:\n"
|
||||
"-hostid (int); the number of the host\n"
|
||||
"-file_name (string); the name of the file to send\n"
|
||||
);
|
||||
exit(0);
|
||||
} else {
|
||||
if (!strncmp("-",argv[i],1)) {
|
||||
fprintf(stderr, "send_file: bad argument '%s'\n", argv[i]);
|
||||
fprintf(stderr, "type send_file -help for more information\n");
|
||||
if(!argv[++i]) {
|
||||
fprintf(stderr, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
host_id = atoi(argv[i]);
|
||||
} else if (!strcmp(argv[i], "-file_name")) {
|
||||
if(!argv[++i]) {
|
||||
fprintf(stderr, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
strcpy(file_name, argv[i]);
|
||||
} else if(!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
} else if(!strcmp(argv[i], "-v") || !strcmp(argv[i], "-version") || !strcmp(argv[i], "--version")) {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else {
|
||||
fprintf(stderr, "unknowen command line argument: %s\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,12 +27,39 @@
|
|||
#include "sched_config.h"
|
||||
#include "sched_shmem.h"
|
||||
#include "str_util.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
int main() {
|
||||
void usage(char *name) {
|
||||
fprintf(stderr,
|
||||
"Displays the work_item part of shared-memory structure.\n\n"
|
||||
"Usage: %s [OPTION]\n\n"
|
||||
"Options:\n"
|
||||
" [ -h | -help | --help ] Show this help text.\n"
|
||||
" [ -v | -version | --version ] Shows version information.\n",
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
SCHED_SHMEM* ssp;
|
||||
int retval;
|
||||
void* p;
|
||||
|
||||
for (int c = 1; c < argc; c++) {
|
||||
std::string option(argv[c]);
|
||||
if(option == "-h" || option == "-help" || option == "--help") {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
} else if(option == "-v" || option == "-version" || option == "--version") {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else {
|
||||
fprintf(stderr, "unknown command line argument: %s\n\n", argv[c]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
retval = config.parse_file();
|
||||
if (retval) {
|
||||
printf("Can't parse config.xml: %s\n", boincerror(retval));
|
||||
|
|
|
@ -25,7 +25,8 @@ Invocation methods:
|
|||
--disable (default if invoked as "stop")
|
||||
Set project to DISABLED mode and stop daemons.
|
||||
|
||||
--status Show status.
|
||||
--status (default if invoked as "status")
|
||||
Show status.
|
||||
|
||||
See "start --help" for options.
|
||||
|
||||
|
@ -644,6 +645,8 @@ Options:
|
|||
print >>sys.stderr, "Based on the invocation name as `start', the default action is --enable."
|
||||
elif program_name == 'stop':
|
||||
print >>sys.stderr, "Based on the invocation name as `stop', the default action is --disable."
|
||||
elif program_name == 'status':
|
||||
print >>sys.stderr, "Based on the invocation name as `status', the default action is --status."
|
||||
sys.exit(1)
|
||||
|
||||
config_filename = boinc_project_path.config_xml_filename
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "common_defs.h"
|
||||
#include "error_numbers.h"
|
||||
#include "str_util.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
#include "sched_config.h"
|
||||
#include "sched_util.h"
|
||||
|
@ -434,23 +435,23 @@ int handle_wu(
|
|||
//
|
||||
all_over_and_validated = true;
|
||||
bool all_over_and_ready_to_assimilate = true; // used for the defer assmilation
|
||||
int most_recently_returned = 0;
|
||||
int most_recently_returned = 0;
|
||||
for (i=0; i<items.size(); i++) {
|
||||
TRANSITIONER_ITEM& res_item = items[i];
|
||||
if (res_item.res_id) {
|
||||
if (res_item.res_server_state == RESULT_SERVER_STATE_OVER) {
|
||||
if ( res_item.res_received_time > most_recently_returned ) {
|
||||
most_recently_returned = res_item.res_received_time;
|
||||
}
|
||||
if ( res_item.res_received_time > most_recently_returned ) {
|
||||
most_recently_returned = res_item.res_received_time;
|
||||
}
|
||||
if (res_item.res_outcome == RESULT_OUTCOME_SUCCESS) {
|
||||
if (res_item.res_validate_state == VALIDATE_STATE_INIT) {
|
||||
all_over_and_validated = false;
|
||||
all_over_and_ready_to_assimilate = false;
|
||||
}
|
||||
} else if ( res_item.res_outcome == RESULT_OUTCOME_NO_REPLY ) {
|
||||
if ( ( res_item.res_report_deadline + config.grace_period_hours*60*60 ) > now ) {
|
||||
all_over_and_validated = false;
|
||||
}
|
||||
if ( ( res_item.res_report_deadline + config.grace_period_hours*60*60 ) > now ) {
|
||||
all_over_and_validated = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
all_over_and_validated = false;
|
||||
|
@ -466,7 +467,7 @@ int handle_wu(
|
|||
//
|
||||
if (all_over_and_ready_to_assimilate == true && wu_item.assimilate_state == ASSIMILATE_INIT && items.size() > 0 && wu_item.canonical_resultid > 0
|
||||
) {
|
||||
wu_item.assimilate_state = ASSIMILATE_READY;
|
||||
wu_item.assimilate_state = ASSIMILATE_READY;
|
||||
log_messages.printf(MSG_NORMAL,
|
||||
"[WU#%d %s] Deferred assimililation now set to ASSIMILATE_STATE_READY\n",
|
||||
wu_item.id, wu_item.name
|
||||
|
@ -526,7 +527,7 @@ int handle_wu(
|
|||
}
|
||||
}
|
||||
} else if ( wu_item.assimilate_state == ASSIMILATE_DONE ) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[WU#%d %s] not checking for items to be ready for delete because the deferred delete time has not expired. That will occur in %d seconds\n",
|
||||
wu_item.id,
|
||||
wu_item.name,
|
||||
|
@ -566,30 +567,33 @@ int handle_wu(
|
|||
wu_item.transition_time = x;
|
||||
}
|
||||
} else if ( res_item.res_server_state == RESULT_SERVER_STATE_OVER ) {
|
||||
if ( res_item.res_outcome == RESULT_OUTCOME_NO_REPLY ) {
|
||||
// Transition again after the grace period has expired
|
||||
if ( ( res_item.res_report_deadline + config.grace_period_hours*60*60 ) > now ) {
|
||||
x = res_item.res_report_deadline + config.grace_period_hours*60*60;
|
||||
if (x > max_grace_or_delay_time) {
|
||||
max_grace_or_delay_time = x;
|
||||
}
|
||||
}
|
||||
} else if ( res_item.res_outcome == RESULT_OUTCOME_SUCCESS || res_item.res_outcome == RESULT_OUTCOME_CLIENT_ERROR || res_item.res_outcome == RESULT_OUTCOME_VALIDATE_ERROR) {
|
||||
// Transition again after deferred delete period has experied
|
||||
if ( (res_item.res_received_time + config.delete_delay_hours*60*60) > now ) {
|
||||
x = res_item.res_received_time + config.delete_delay_hours*60*60;
|
||||
if (x > max_grace_or_delay_time && res_item.res_received_time > 0) {
|
||||
max_grace_or_delay_time = x;
|
||||
}
|
||||
}
|
||||
if ( res_item.res_outcome == RESULT_OUTCOME_NO_REPLY ) {
|
||||
// Transition again after the grace period has expired
|
||||
//
|
||||
if ((res_item.res_report_deadline + config.grace_period_hours*60*60) > now) {
|
||||
x = res_item.res_report_deadline + config.grace_period_hours*60*60;
|
||||
if (x > max_grace_or_delay_time) {
|
||||
max_grace_or_delay_time = x;
|
||||
}
|
||||
}
|
||||
} else if (res_item.res_outcome == RESULT_OUTCOME_SUCCESS || res_item.res_outcome == RESULT_OUTCOME_CLIENT_ERROR || res_item.res_outcome == RESULT_OUTCOME_VALIDATE_ERROR) {
|
||||
// Transition again after deferred delete period has experied
|
||||
//
|
||||
if ((res_item.res_received_time + config.delete_delay_hours*60*60) > now) {
|
||||
x = res_item.res_received_time + config.delete_delay_hours*60*60;
|
||||
if (x > max_grace_or_delay_time && res_item.res_received_time > 0) {
|
||||
max_grace_or_delay_time = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If either of the grace period or delete delay is less than
|
||||
// the next transition time then use that value
|
||||
//
|
||||
if ( max_grace_or_delay_time < wu_item.transition_time && max_grace_or_delay_time > now && ninprogress == 0) {
|
||||
if (max_grace_or_delay_time < wu_item.transition_time && max_grace_or_delay_time > now && ninprogress == 0) {
|
||||
wu_item.transition_time = max_grace_or_delay_time;
|
||||
log_messages.printf(MSG_NORMAL,
|
||||
"[WU#%d %s] Delaying transition due to grace period or delete day. New transition time = %d sec\n",
|
||||
|
@ -693,6 +697,24 @@ void main_loop() {
|
|||
}
|
||||
}
|
||||
|
||||
void usage(char *name) {
|
||||
fprintf(stderr,
|
||||
"Handles transitions in the state of a WU\n"
|
||||
" - a result has become DONE (via timeout or client reply)\n"
|
||||
" - the WU error mask is set (e.g. by validater)\n"
|
||||
" - assimilation is finished\n\n"
|
||||
"Usage: %s [OPTION]...\n\n"
|
||||
"Options: \n"
|
||||
" [ -one_pass ] do one pass, then exit\n"
|
||||
" [ -d x ] debug level x\n"
|
||||
" [ -mod n i ] process only WUs with (id mod n) == i\n"
|
||||
" [ -sleep_interval x ] sleep x seconds if nothing to do\n"
|
||||
" [ -h | -help | --help ] Show this help text.\n"
|
||||
" [ -v | -version | --version ] Shows version information.\n",
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int i, retval;
|
||||
char path[256];
|
||||
|
@ -702,13 +724,38 @@ int main(int argc, char** argv) {
|
|||
if (!strcmp(argv[i], "-one_pass")) {
|
||||
one_pass = true;
|
||||
} else if (!strcmp(argv[i], "-d")) {
|
||||
log_messages.set_debug_level(atoi(argv[++i]));
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
log_messages.set_debug_level(atoi(argv[i]));
|
||||
} else if (!strcmp(argv[i], "-mod")) {
|
||||
if(!argv[i+1] || !argv[i+2]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires two arguments\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
mod_n = atoi(argv[++i]);
|
||||
mod_i = atoi(argv[++i]);
|
||||
do_mod = true;
|
||||
} else if (!strcmp(argv[i], "-sleep_interval")) {
|
||||
sleep_interval = atoi(argv[++i]);
|
||||
if(!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
sleep_interval = atoi(argv[i]);
|
||||
} else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
} else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "-version") || !strcmp(argv[i], "--version")) {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else {
|
||||
log_messages.printf(MSG_CRITICAL, "unknown command line argument: %s\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (!one_pass) check_stop_daemons();
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "util.h"
|
||||
#include "error_numbers.h"
|
||||
#include "str_util.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
#include "sched_config.h"
|
||||
#include "sched_util.h"
|
||||
|
@ -137,6 +138,23 @@ int main_loop(bool one_pass) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void usage(char *name) {
|
||||
fprintf(stderr,
|
||||
"Framework for trickle-up message handler\n"
|
||||
"This program must be linked with an app-specific function:\n\n"
|
||||
"int handle_trickle(MSG_FROM_HOST&)\n"
|
||||
" - handle a trickle message\n\n"
|
||||
"return nonzero on error\n\n"
|
||||
"Usage: %s [OPTION]...\n\n"
|
||||
"Options:\n"
|
||||
" -variety X Set Variety to X\n"
|
||||
" [ -d X ] Set debug level to X\n"
|
||||
" [ -one_pass ] Make one pass through table, then exit\n"
|
||||
" [ -h | -help | --help ] Show this help text\n"
|
||||
" [ -v | -version | --version ] Shows version information\n",
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int i, retval;
|
||||
|
@ -148,13 +166,29 @@ int main(int argc, char** argv) {
|
|||
if (!strcmp(argv[i], "-one_pass")) {
|
||||
one_pass = true;
|
||||
} else if (!strcmp(argv[i], "-variety")) {
|
||||
strcpy(variety, argv[++i]);
|
||||
if (!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
strcpy(variety, argv[i]);
|
||||
} else if (!strcmp(argv[i], "-d")) {
|
||||
log_messages.set_debug_level(atoi(argv[++i]));
|
||||
if (!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
log_messages.set_debug_level(atoi(argv[i]));
|
||||
} else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "-version") || !strcmp(argv[i], "--version")) {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
} else {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"unrecognized arg: %s\n", argv[i]
|
||||
);
|
||||
log_messages.printf(MSG_CRITICAL, "unknown command line argument: %s\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "util.h"
|
||||
#include "str_util.h"
|
||||
#include "error_numbers.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
#include "sched_config.h"
|
||||
#include "sched_util.h"
|
||||
|
@ -177,6 +178,26 @@ int update_teams() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void usage(char *name) {
|
||||
fprintf(stderr,
|
||||
"Update average credit for idle users, hosts and teams.\n"
|
||||
"These fields are updates as new credit is granted;\n"
|
||||
"the purpose of this program is to decay credit of entities\n"
|
||||
"that are inactive for long periods.\n"
|
||||
"Hence it should be run about once a day at most.\n\n"
|
||||
"Also updates the nusers field of teams\n\n"
|
||||
"Usage: %s [OPTION]...\n\n"
|
||||
"Options:\n"
|
||||
" [ -d X ] Set debug level to X\n"
|
||||
" [ -update_teams ] Updates teams.\n"
|
||||
" [ -update_users ] Updates users.\n"
|
||||
" [ -update_hosts ] Updates hosts.\n"
|
||||
" [ -h | -help | --help ] Shows this help text\n"
|
||||
" [ -v | -version | --version ] Shows version information\n",
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int retval, i;
|
||||
bool do_update_teams = false, do_update_users = false;
|
||||
|
@ -194,9 +215,22 @@ int main(int argc, char** argv) {
|
|||
} else if (!strcmp(argv[i], "-update_hosts")) {
|
||||
do_update_hosts = true;
|
||||
} else if (!strcmp(argv[i], "-d")) {
|
||||
log_messages.set_debug_level(atoi(argv[++i]));
|
||||
if (!argv[++i]) {
|
||||
log_messages.printf(MSG_CRITICAL, "%s requires an argument\n\n", argv[--i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
log_messages.set_debug_level(atoi(argv[i]));
|
||||
} else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "-version") || !strcmp(argv[i], "--version")) {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
} else {
|
||||
log_messages.printf(MSG_CRITICAL, "Unrecognized arg: %s\n", argv[i]);
|
||||
log_messages.printf(MSG_CRITICAL, "unknown command line argument: %s\n\n", argv[i]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <string>
|
||||
|
||||
#include "boinc_db.h"
|
||||
#include "svn_version.h"
|
||||
|
||||
#include "parse.h"
|
||||
#include "util.h"
|
||||
|
@ -99,11 +100,41 @@ int handle_result(DB_RESULT& result) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void usage(char *name) {
|
||||
fprintf(stderr,
|
||||
"Looks for results with missing input files\n\n"
|
||||
"Usage: %s [OPTION]\n\n"
|
||||
"Options:\n"
|
||||
" [ -repair ] change them to server_state OVER,\n"
|
||||
" outcome COULDNT_SEND\n"
|
||||
" [ -h | -help | --help ] Shows this help text\n"
|
||||
" [ -v | -version | --version ] Shows version information\n",
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
DB_RESULT result;
|
||||
char clause[256];
|
||||
int retval, n, nerr;
|
||||
|
||||
for(int c = 1; c < argc; c++) {
|
||||
std::string option(argv[c]);
|
||||
if(option == "-h" || option == "-help" || option == "--help") {
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
} else if(option == "-v" || option == "-version" || option == "--version") {
|
||||
printf("%s\n", SVN_VERSION);
|
||||
exit(0);
|
||||
} else if (option == "-repair") {
|
||||
repair = true;
|
||||
} else {
|
||||
fprintf(stderr, "unknown command line argument: %s\n\n", argv[c]);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
retval = config.parse_file();
|
||||
if (retval) exit(1);
|
||||
|
||||
|
@ -112,7 +143,6 @@ int main(int argc, char** argv) {
|
|||
printf("boinc_db.open: %d\n", retval);
|
||||
exit(1);
|
||||
}
|
||||
if (argc > 1 && !strcmp(argv[1], "-repair")) repair = true;
|
||||
|
||||
n = nerr = 0;
|
||||
printf("Unsent results:\n");
|
||||
|
|
Loading…
Reference in New Issue