python script - restart LinuxCNC with subprocess
- nhanpham
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 77
- Thank you received: 1
07 Mar 2022 01:03 #236553
by nhanpham
python script - restart LinuxCNC with subprocess was created 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
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.
- BigJohnT
- Offline
- Administrator
Less
More
- Posts: 7000
- Thank you received: 1172
07 Mar 2022 17:10 #236585
by BigJohnT
Replied by BigJohnT on topic python script - restart LinuxCNC with subprocess
You might mention which GUI you're using...
JT
JT
Please Log in or Create an account to join the conversation.
- BigJohnT
- Offline
- Administrator
Less
More
- Posts: 7000
- Thank you received: 1172
07 Mar 2022 17:28 #236587
by BigJohnT
Replied by BigJohnT on topic python script - restart LinuxCNC with subprocess
This might help you get started.
JT
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