30 int size =
sizeof(
state);
38 fprintf(
stderr,
"Usage: mtransition [-v] [-d debug_flag] [-f] [-h Hostname] [-e Experiment] commands...\n");
41 fprintf(
stderr,
" -d debug_flag - passed through cm_transition(debug_flag): 0=normal, 1=printf, 2=cm_msg(MINFO)\n");
42 fprintf(
stderr,
" -f - force new state regardless of current state\n");
45 fprintf(
stderr,
" -h Hostname - connect to mserver on remote host\n");
46 fprintf(
stderr,
" -e Experiment - connect to non-default experiment\n");
52 fprintf(
stderr,
" STARTABORT - cleanup after failed START\n");
54 fprintf(
stderr,
" DELAY \"/logger/Auto restart delay\" - sleep for time specified in ODB variable\n");
55 fprintf(
stderr,
" IF \"/logger/Auto restart\" - continue only if ODB variable is set to TRUE\n");
87 for (
int i = 1;
i <
argc;
i++) {
88 if (
argv[
i][0] ==
'-') {
89 if (
argv[
i][1] ==
'v')
91 else if (
argv[
i][1] ==
'f')
93 else if (
argv[
i][1] ==
'a')
95 else if (
argv[
i][1] ==
'm')
120 fprintf(
stderr,
"Error: Cannot connect to experiment \'%s\' on host \'%s\', status %d\n",
143 if (
argv[
i][0] ==
'-') {
147 if (
argv[
i][1] ==
'd')
149 else if (
argv[
i][1] ==
'h')
151 if (
argv[
i][1] ==
'e')
164 printf(
"START: Run is already started\n");
169 printf(
"START: Run is paused, please use \"RESUME\"\n");
201 printf(
"START: cm_transition status %d, message \'%s\'\n",
status,
str);
211 printf(
"Run is already stopped, stopping again.\n");
218 printf(
"STOP: cm_transition status %d, message \'%s\'\n",
status,
str);
227 printf(
"PAUSE: Run is already paused\n");
232 printf(
"PAUSE: Run is not started\n");
242 printf(
"PAUSE: cm_transition status %d, message \'%s\'\n",
status,
str);
249 printf(
"RESUME: Run is already running\n");
252 printf(
"RESUME: Run is not paused\n");
261 printf(
"RESUME: cm_transition status %d, message \'%s\'\n",
status,
str);
268 printf(
"STARTABORT: cm_transition status %d, message \'%s\'\n",
status,
str);
277 const char* arg =
argv[++
i];
282 }
else if (arg[0] ==
'/') {
283 int size =
sizeof(delay);
294 printf(
"DELAY \'%s\' %d sec\n", arg, delay);
306 const char* arg =
argv[++
i];
311 }
else if (arg[0] ==
'/') {
312 int size =
sizeof(
value);
346 printf(
"waiting for transition to finish!\n");
INT cm_get_experiment_database(HNDLE *hDB, HNDLE *hKeyClient)
INT cm_transition(INT transition, INT run_number, char *errstr, INT errstr_size, INT async_flag, INT debug_flag)
INT cm_connect_experiment1(const char *host_name, const char *default_exp_name, const char *client_name, void(*func)(char *), INT odb_size, DWORD watchdog_timeout)
INT cm_disconnect_experiment(void)
INT cm_get_environment(char *host_name, int host_name_size, char *exp_name, int exp_name_size)
INT cm_transition_cleanup()
INT ss_sleep(INT millisec)
INT cm_set_msg_print(INT system_mask, INT user_mask, int(*func)(const char *))
INT db_get_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, void *data, INT *buf_size, DWORD type, BOOL create)
INT db_set_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, const void *data, INT data_size, INT num_values, DWORD type)
char exp_name[NAME_LENGTH]
char host_name[HOST_NAME_LENGTH]
#define DEFAULT_WATCHDOG_TIMEOUT
int read_state(HNDLE hDB)
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)