Many thanks for the reply,
The question is how these command are executed. Are they executed as root or just as a normal user?
How can I execute the command as a root?
Here is the code showing how I am using the commands through the QProcess.
void kentriko::xekina(){
process.start("/etc/init.d/mysqld start");
}
void kentriko::dixe(){
ui.dixe_l->setText(process.readAllStandardOutput());
}
void kentriko::stamata(){
process.execute("/etc/init.d/mysqld stop");
ui.dixe_l->setText(process.readAllStandardError());
}
void kentriko::xekina(){
process.start("/etc/init.d/mysqld start");
}
void kentriko::dixe(){
ui.dixe_l->setText(process.readAllStandardOutput());
}
void kentriko::stamata(){
process.execute("/etc/init.d/mysqld stop");
ui.dixe_l->setText(process.readAllStandardError());
}
To copy to clipboard, switch view to plain text mode
What I mainly want to do is to control the mysqld process. The problem that I have is that my code cannot actually open the database unless i have opened it from the command line before as a Super user.
I believe that the problem is that i am not executing the command as a superuser. How can i do that?
Generally how do we handle processes? any short example with the mysqld process?
How can we detect weather a process is already running before making a new qprocess object?
Many thanks in advance,
Kindest regards.
Bookmarks