// $Id: mbsprint.cxx 2226 2014-04-04 07:32:45Z linev $ /************************************************************ * The Data Acquisition Backbone Core (DABC) * ************************************************************ * Copyright (C) 2009 - * * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * Planckstr. 1, 64291 Darmstadt, Germany * * Contact: http://dabc.gsi.de * ************************************************************ * This software can be used under the GPL license * * agreements as stated in LICENSE.txt file * * which is part of the distribution. * ************************************************************/ #include #include #include #include #include "mbs/api.h" int usage(const char *errstr = nullptr) { if (errstr) printf("Error: %s\n\n", errstr); printf("Utility for execute commands on remote MBS node\n"); printf(" mbscmd nodename [args] -cmd cmd1 [-cmd cmd2] [-cmd cmd3] ...\n"); printf("Arguments:\n"); printf(" -logport number - port number of log channel (-1 - off, default 6007)\n"); printf(" -cmdport number - port number of command channel (-1 - off, default 6019)\n"); printf(" -prompter - connect to MBS prompter (same as -cmdport 6006)\n"); printf(" -stat - enable reading of status record from port 6008 (default off)\n"); printf(" -cmd mbs_command - MBS command to execute (can be any number)\n"); printf(" -tmout time - timeout for command execution (default 5 sec)\n"); printf(" -wait time - wait time at the end of utility (default 1 sec)\n"); return errstr ? 1 : 0; } int main(int argc, char* argv[]) { if (argc < 2) return usage(); int logport = 6007, cmdport = 6019, statport = 0; double tmout = 5., waittm = 1.; std::vector cmds; int n = 1; while (++n