1 #ifndef __JRUNCONTROL__JCLIENT__ 
    2 #define __JRUNCONTROL__JCLIENT__ 
   66             const std::string& __hostname,
 
   67             const std::string& __start_command = 
"") :
 
   92       if (start_command != 
"") {
 
   96         shell << start_command << endl;
 
  110     void stop(
const int signal = -9)
 
  115       if (start_command != 
"") {
 
  117         const string header  = 
"__header___";
 
  118         const string trailer = 
"__trailer__";
 
  122         os << 
"ssh " << hostname << 
' ' 
  124            << 
"echo" << 
' ' << header << 
";" 
  125            << 
"ps hax -o '%p %a'"     << 
";" 
  126            << 
"echo" << 
' ' << trailer
 
  131         shell << os.str() << endl;
 
  137         while (
getline(shell, buffer) && buffer.find(header)  == string::npos) {}
 
  141         while (
getline(shell, buffer) && buffer.find(trailer) == string::npos) {
 
  148           if (is >> pid && 
getline(is >> ws, buffer)) {
 
  149             if (start_command.find(buffer) != string::npos) {
 
  150               os << 
"ssh " << hostname << 
' ' 
  152                  << 
"kill " << signal << 
" " << pid << 
" </dev/null >&/dev/null" 
  160         if (os.str() != 
"") {
 
  161           shell << os.str() << endl;
 
  208       return start_command;
 
  219       return mode == SLEEP;
 
  230       return mode == ACTIVE;
 
  241       return mode == IGNORE;
 
  252       return mode == ILLEGAL;
 
  271         this->is_alive  = 
true;
 
  278         this->is_alive  = 
false;
 
  291         istringstream 
is(buffer);
 
  299           this->event_name   = 
event.getName();
 
  300           this->event_number = 
event.getNumber();
 
  301           this->state_name   = state;
 
  420       in >> client.hostname;
 
  424         getline(in >> std::ws, client.start_command);
 
  446       out << client.hostname;
 
  448       out << client.start_command;
 
  470       start_command = start_command.trim();
 
  471       start_command = start_command.replace(
"  ", 
" ");
 
  473       start_command.replace(
"$HOST$",   hostname);
 
  474       start_command.replace(
"$NAME$",   
name);
 
  475       start_command.replace(
"$SERVER$", 
SERVER);
 
  476       start_command.replace(
"$LOGGER$", 
LOGGER);
 
  480       if (pos != string::npos) {
 
  481         start_command.replace(
"$ARGS$", 
name.substr(pos + 1));
 
JSocketNonblockingWriter out
writer for outgoing messages 
 
The JShell clas can be used to interact with the shell via I/O streams. 
 
int getEventnumber() const 
Get number of last event. 
 
bool isIgnore() const 
Check ignore mode. 
 
static const JTag DISPTAG_Died("Died")
 
Wrapper class around STL string class. 
 
bool update(const JNET::JTag &tag, const std::string &buffer)
Update client. 
 
friend std::istream & operator>>(std::istream &in, JClient &client)
Read client from input. 
 
const std::string & getStatename() const 
Get name of current state. 
 
bool getAlive() const 
Get alive status. 
 
ControlHost client manager. 
 
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null if do_usage *then usage $script fi SERVER
 
static std::string LOGGER
host name of message logger 
 
int getDied() const 
Get died count. 
 
static const std::string TOKEN_DELIMETER
 
void start()
Start process. 
 
void setMode(const JMode mode)
Set mode. 
 
int getBorn() const 
Get born count. 
 
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable SERVER localhost define_variable LOGGER if do_usage *then usage $script[host[local file]] fi case set_variable LOGGER
 
then echo Test string reversed by client(hit< return > to continue)." JProcess -c "JEcho-r" -C fi if (( 1 ))
 
JLANG::JString start_command
 
bool isActive() const 
Check active mode. 
 
friend std::ostream & operator<<(std::ostream &out, const JClient &client)
Write client to output. 
 
static const std::string RUN_CONTROL_CLIENT
 
void setAlive(const bool alive)
Set alive status. 
 
JSocketInputChannel_t in
reader for incoming messages 
 
static const JNET::JTag RC_REPLY
 
void stop(const int signal=-9)
Stop process. 
 
JMode getMode() const 
Get mode. 
 
static const std::string CLIENTNAME_DELIMETER
 
const std::string & getFullName() const 
Get full name of run control client. 
 
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line. 
 
bool isSleep() const 
Check sleep mode. 
 
Auxiliary class for handling event name and optional number. 
 
JShell & flush(std::ostream &out=null)
Extracts characters from this shell and flush them to the given output stream until the prompt is rea...
 
static const JTag DISPTAG_Born("Born")
 
bool isIllegal() const 
Check illegal mode. 
 
Auxiliary class to specify white space character(s) in currect locale. 
 
const std::string & getHostname() const 
Get host name of run control client. 
 
const std::string & getName() const 
Get name of run control client. 
 
static JShell & getInstance()
Get reference to unique instance of this class object. 
 
Shell interaction via I/O streams. 
 
static std::string SERVER
host name of message server 
 
JClient(const std::string &__name, const std::string &__hostname, const std::string &__start_command="")
Constructor. 
 
const std::string & getEventname() const 
Get name of last event. 
 
std::string getFullName(const std::string &hostname, const std::string &name)
Get full name of run control client. 
 
void configure()
Configure client parameters. 
 
JClient()
Default constructor. 
 
const std::string & getStartCommand() const 
Get start command of run control client.