summaryrefslogtreecommitdiffstats
path: root/servers/admin_sys_ctl_server_lin/src
diff options
context:
space:
mode:
Diffstat (limited to 'servers/admin_sys_ctl_server_lin/src')
-rw-r--r--servers/admin_sys_ctl_server_lin/src/admin_sys_ctl.cpp61
1 files changed, 57 insertions, 4 deletions
diff --git a/servers/admin_sys_ctl_server_lin/src/admin_sys_ctl.cpp b/servers/admin_sys_ctl_server_lin/src/admin_sys_ctl.cpp
index 3cce4b5..f0cf958 100644
--- a/servers/admin_sys_ctl_server_lin/src/admin_sys_ctl.cpp
+++ b/servers/admin_sys_ctl_server_lin/src/admin_sys_ctl.cpp
@@ -181,6 +181,8 @@ void SysCtlSocket::commandLoop() {
ds >> subCommand;
if (subCommand == "TERMINALS") {
clearFrameTail();
+ ds << TQString("OK");
+ writeEndOfFrame();
TQSqlCursor databaseActivityCursor("sessions", TRUE, m_terminals_database);
databaseActivityCursor.select();
while (databaseActivityCursor.next()) {
@@ -205,6 +207,8 @@ void SysCtlSocket::commandLoop() {
}
else if (subCommand == "WORKSPACES") {
clearFrameTail();
+ ds << TQString("OK");
+ writeEndOfFrame();
TQSqlCursor databaseActivityCursor("activity", TRUE, m_workspaces_database);
databaseActivityCursor.select();
while (databaseActivityCursor.next()) {
@@ -224,6 +228,8 @@ void SysCtlSocket::commandLoop() {
}
else {
clearFrameTail();
+ ds << TQString("ERRINVCMD");
+ writeEndOfFrame();
}
}
else if (command == "SESSION") {
@@ -235,22 +241,69 @@ void SysCtlSocket::commandLoop() {
TQ_UINT32 delay;
ds >> delay;
clearFrameTail();
- // FIXME
+ // FIXME UNIMPLEMENTED
+ ds << TQString("ERRINVCMD");
+ writeEndOfFrame();
}
else if (subCommand == "CANCEL_LOGOFF_TERMINAL") {
clearFrameTail();
- // FIXME
+ // FIXME UNIMPLEMENTED
+ ds << TQString("ERRINVCMD");
+ writeEndOfFrame();
}
else if (subCommand == "KILL_TERMINAL") {
clearFrameTail();
- // FIXME
+ TQSqlCursor databaseActivityCursor("sessions", TRUE, m_terminals_database);
+ databaseActivityCursor.select(TQString("pk=%1").arg(sessionID));
+ if (databaseActivityCursor.next()) {
+ // Gather server information
+ TQString server_name = databaseActivityCursor.value("servername").toString();
+ int server_pid = databaseActivityCursor.value("server_pid").toInt();
+ // Kill server process
+ TQString command = TQString("ssh root@%1 'kill -9 %2'").arg(server_name).arg(server_pid);
+ if (system(command.ascii()) == 0) {
+ // Remove database entry
+ databaseActivityCursor.select(TQString("pk=%1").arg(sessionID));
+ if (databaseActivityCursor.next()) {
+ databaseActivityCursor.primeDelete();
+ databaseActivityCursor.del(true);
+ }
+ ds << TQString("OK");
+ }
+ else {
+ ds << TQString("ERRFAILED");
+ }
+ writeEndOfFrame();
+ }
+ else {
+ ds << TQString("ERRINVCMD");
+ }
+ writeEndOfFrame();
}
else if (subCommand == "KILL_WORKSPACE") {
clearFrameTail();
- // FIXME
+ TQSqlCursor databaseActivityCursor("activity", TRUE, m_workspaces_database);
+ databaseActivityCursor.select(TQString("pk=%1").arg(sessionID));
+ if (databaseActivityCursor.next()) {
+ databaseActivityCursor.select(TQString("pk=%1").arg(sessionID));
+ if (databaseActivityCursor.next()) {
+ TQSqlRecord *buffer = databaseActivityCursor.primeUpdate();
+ buffer->setValue("terminate", true);
+ databaseActivityCursor.update();
+ }
+
+ ds << TQString("OK");
+ writeEndOfFrame();
+ }
+ else {
+ ds << TQString("ERRINVCMD");
+ }
+ writeEndOfFrame();
}
else {
clearFrameTail();
+ ds << TQString("ERRINVCMD");
+ writeEndOfFrame();
}
}
else {