start sea server even remotely over ssh

this works on neutron instruments (account equal host)
and on linse-c
This commit is contained in:
2025-06-10 16:39:49 +02:00
parent 3e53005b92
commit bc33026b2c
6 changed files with 47 additions and 25 deletions

View File

@ -19,6 +19,7 @@
#include <qevent.h>
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>
#include "instr_hosts.h"
#include "utils.h"
@ -646,13 +647,13 @@ SeaSet::SeaSet(QSplitter *parent, long range, const char *name)
}
void SeaSet::setHost(const QString &hostport) {
/*
static char seaStart[64];
static char cmd[128], psw[32];
static char *user;
char host[128], instr[32];
char *hp = (char *)hostport.latin1();
char *p;
int port;
*/
this->hostport = hostport;
sc->setHost(hostport.latin1(), "sea");
@ -660,18 +661,30 @@ void SeaSet::setHost(const QString &hostport) {
gc->setHost(hostport.latin1(), "graph");
ec->setHost(hostport.latin1(), "graph");
/*
p = strchr(hp, ':');
if (p == NULL) {
InstrHost("sea", hp, instr, sizeof instr, host, sizeof host, &port);
if (strcmp(host, instr) == 0) {
snprintf(seaStart, sizeof seaStart, "ssh %s@%s sea start", instr, host);
snprintf(psw, sizeof psw, "SSHPASS=%sLNS", strtoupper(instr));
user = instr;
} else if (strcmp(host, "linse-c") == 0) {
snprintf(psw, sizeof psw, "SSHPASS=1%dlns1", 7);
user = "l_samenv";
} else {
snprintf(seaStart, sizeof seaStart, "ssh l_samenv@%s sea start %s", host, instr);
return;
}
putenv(psw);
snprintf(cmd, sizeof cmd, "sshpass -e ssh -Y %s@%s sea start %s",
user, host, instr);
sc->startServer = cmd;
for (int i=0; i<30; i++) {
sc->handleBuffer(1);
if (sc->connect_state == SicsConnection::connect_waitlogin) {
break;
}
usleep(250000);
}
sc->startServer = seaStart;
}
*/
}
void SeaSet::setLive(bool on) {