A
A
alexey_abramov2016-09-26 22:39:15
Qt
alexey_abramov, 2016-09-26 22:39:15

QProcess - how to execute shell commands in sequence?

Hello!
I am making a program that should change the binary via SSH. It is in autorun, therefore, if it is running, it cannot be copied via scp, it will write that the busy text file of
Question 2.
1. With QProcess::execute("ssh [email protected] 'kill -15 $(pgrep prog")' ) or using killall prog cannot find the killall and kill commands. By the way, rm does not see this file. Why are such "glitches" caused, if by accessing directly from the terminal via ssh, all commands are executed.
By the way, text files are copied via execute("scp ....") correctly and normally
2. The second question follows from the first, it seems to me that it is required not to work using execute, but through the creation of a "terminal session" start ("ssh [email protected]"), and then continue to execute commands. But how? (Alas, I didn’t find this in the docks, please tell me how to sequentially execute commands not through execute, so as not to create a new session every time, but to work in 1, for example, go to ssh and work inside there. It is advisable to just point to the desired method
Thank you in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Armenian Radio, 2016-09-27
@alexey_abramov

1. The commands do not work because they are either built-in bash commands (kill), or the path must be written in full (killall - /usr/bin/killall).
2. To work over ssh, you need not qprocess, but libssh. Through it, you can open an SSH session and command it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question