python script - restart LinuxCNC with subprocess

  • nhanpham
  • nhanpham's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
07 Mar 2022 01:03 #236553 by nhanpham
Hi all,

I want to restart linuxcnc by the python script with subprocess. 

I kill the process:
- linuxcnc
- linuxcncsvr
- rtapi_app
- milltask

But this can't turnOFF linuxCNC GUI.
          
Could someone help me to deal with this problem? I want to start and terminate linuxcnc all by python scripts.
thank you very much

Please Log in or Create an account to join the conversation.

More
07 Mar 2022 17:10 #236585 by BigJohnT
You might mention which GUI you're using...

JT

Please Log in or Create an account to join the conversation.

More
07 Mar 2022 17:28 #236587 by BigJohnT
This might help you get started.
import time
import subprocess

def open_program(path_name):

    return subprocess.Popen(path_name)

def close_program(p):
    p.terminate()

p=open_program("notepad")
time.sleep(3)
close_program(p)

JT

Please Log in or Create an account to join the conversation.

Time to create page: 0.046 seconds
Powered by Kunena Forum