#include int main () { try { saga::context c ("ssh"); c.set_attribute ("UserID", "merzky"); // c.set_defaults (); // has been removed as of newest SAGA spec saga::session s; s.add_context (c); std::string host; // host = "localhost"; // host = "172.16.216.130"; host = "qb.loni.org"; saga::job::service js (s, std::string ("ssh://") + host); saga::job::ostream in; saga::job::istream out; saga::job::istream err; saga::job::job j = js.run_job ("/bin/uname -a", host, in, out, err); while ( true ) { char buffer[255]; out.read (buffer, sizeof (buffer)); if ( out.gcount () > 0 ) std::cout << std::string (buffer, out.gcount ()); if ( out.fail () ) break; } j.wait (); if ( j.get_state () == saga::job::Done ) { std::cout << "job done\n"; } else { std::cout << "job failed\n"; } } catch ( const saga::exception & e ) { std::cerr << e.what (); } }