1566 {
1567 bfs::path dd = instance.data_dir_name;
1568 bfs::path reout = dd / "stdout.txt";
1569 bfs::path reerr_sl = dd / "stderr.txt";
1570 bfs::path reerr_base = bfs::path(
"stderr." +
launch_time +
".txt");
1571 bfs::path reerr = dd / reerr_base;
1572 bfs::path pidf = dd / bfs::path(string(node_executable_name) + ".pid");
1574 try {
1576 } catch (const bfs::filesystem_error &ex) {
1577 cerr <<
"deploy_config_files threw " << ex.what() << endl;
1578 exit (-1);
1579 }
1580
1582 info.
remote = !host->is_local();
1583
1584 string install_path;
1586 const auto node_num = boost::lexical_cast<uint16_t,string>(instance.get_node_num());
1589 }
1590 }
1591 string eosdcmd = install_path + "programs/nodeop/" + string(node_executable_name) + " ";
1593 eosdcmd += "--skip-transaction-signatures ";
1594 }
1597 }
1599 const auto node_num = boost::lexical_cast<uint16_t,string>(instance.get_node_num());
1602 }
1603 }
1604
1606 eosdcmd += "--enable-stale-production true ";
1608 }
1609
1610 eosdcmd += " --config-dir " + instance.config_dir_name + " --data-dir " + instance.data_dir_name;
1611 eosdcmd += " --genesis-json " + instance.config_dir_name + "/genesis.json";
1612 if (gts.length()) {
1613 eosdcmd += " --genesis-timestamp " + gts;
1614 }
1615
1616 if (eosdcmd.find("sysio::history_api_plugin") != string::npos && eosdcmd.find("sysio::trace_api_plugin") != string::npos){
1617
1621 }
1622
1623 if (!host->is_local()) {
1624 if (instance.node->dont_start) {
1625 cerr <<
"Unable to use \"unstarted-nodes\" with a remote hose" << endl;
1626 exit (-1);
1627 }
1628 string cmdl ("cd ");
1629 cmdl += host->sysio_home + "; nohup " + eosdcmd + " > "
1630 + reout.string() + " 2> " + reerr.string() + "& echo $! > " + pidf.string()
1631 + "; rm -f " + reerr_sl.string()
1632 + "; ln -s " + reerr_base.string() + " " + reerr_sl.string();
1633 if (!
do_ssh (cmdl, host->host_name)){
1634 cerr <<
"Unable to invoke " << cmdl
1635 << " on host " << host->host_name << endl;
1636 exit (-1);
1637 }
1638
1639 string cmd = "cd " + host->sysio_home + "; kill -15 $(cat " + pidf.string() + ")";
1640 format_ssh (cmd, host->host_name, info.kill_cmd);
1641 }
1642 else if (!instance.node->dont_start) {
1643 cerr <<
"spawning child, " << eosdcmd << endl;
1644
1645 bp::child c(eosdcmd, bp::std_out > reout, bp::std_err > reerr );
1646 bfs::remove(reerr_sl);
1647 bfs::create_symlink (reerr_base, reerr_sl);
1648
1649 bfs::ofstream pidout (pidf);
1650 pidout << c.id() << flush;
1651 pidout.close();
1652
1653 info.pid_file = pidf.string();
1654 info.kill_cmd = "";
1655
1656 if(!c.running()) {
1657 cerr <<
"child not running after spawn " << eosdcmd << endl;
1658 for (int i = 0; i > 0; i++) {
1659 if (c.running () ) break;
1660 }
1661 }
1662 c.detach();
1663 }
1664 else {
1665 cerr <<
"not spawning child, " << eosdcmd << endl;
1666
1667 const bfs::path dd = instance.data_dir_name;
1668 const bfs::path start_file = dd / "start.cmd";
1669 bfs::ofstream sf (start_file);
1670
1671 sf << eosdcmd << endl;
1672 sf.close();
1673 }
1675}
string find_and_remove_arg(string str, string substr)
host_def * deploy_config_files(tn_node_def &node)
bool skip_transaction_signatures
bool add_enable_stale_production