Skip to content

Too bad it is no longer update. I like it is simple and direct. I have added starting IB gateway in Ubuntu if anyone like it too. #33

Description

@tonsmons

client.py

@@ -527,8 +552,37 @@
                 args=IB_WEB_API_PROC,
                 cwd=self.client_portal_folder
             ).pid
-
-        return self.server_process
+
+        elif self._operating_system == 'linux':
+            IB_WEB_API_PROC = [self.client_portal_folder+r"/bin/run.sh",r"root/conf.yaml"]
+            process = subprocess.Popen(
+                args=IB_WEB_API_PROC,
+                cwd=self.client_portal_folder,
+                stdout=subprocess.PIPE, universal_newlines=True
+            ).pid
+            time.sleep(2)
+            # get the right process by psutil, the above process takes the pid from run.sh, not the java one
+            for proc in psutil.process_iter():
+                try:
+                    processID = proc.pid
+                    # processName = proc.name()
+                    cmd = proc.cmdline()
+                    if any(r"root/conf.yaml" in s for s in cmd) and not any('run.sh' in s for s in cmd):
+                        self.server_process = processID
+                        break
+                except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
+                    pass
+            # keep alive process
+            IB_WEB_ALIVE = r'while true; do /usr/bin/sleep 300; /usr/bin/curl -ks '+self.ib_gateway_path+'/v1/portal/tickle; done'
+            self.server_alive = subprocess.Popen(args=[IB_WEB_ALIVE], shell=True).pid
+
+        return self.server_process,self.server_alive

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions