Recent

Author Topic: starting external Programms with Tprocess  (Read 7117 times)

cybertom

  • New Member
  • *
  • Posts: 12
starting external Programms with Tprocess
« on: July 07, 2005, 07:27:23 pm »
I use Tprocess to excute Apache start/stop, mysql start/stop ...
there are 2 comboboxes to choose apache or mysql and to choose start or stop
thre is a passwordfield to enter rootpassword

the commandline:
echo " :?: " | su -c "/etc/init.d/apache start"

 :?:= text in passwordfield  
But apache doesn't start.

if modify the commandline to: kdesu -c "/etc/init.d/apache start"
apache does start. (But rootpassword is ask every time i start or stop a programm)
When i type

echo "mypassword" | su -c "/etc/init.d/apache start"

in the konsole* apache doesstart,too.
*=I know i shouldn't do that

What is wrong :?:  :?:
Any ideas to realize programm :!:  :idea:  :!:
Is there any where a better documentation for Tprocess as http://lazarus-ccr.sourceforge.net/kb/  :?:  :?:

Almindor

  • Sr. Member
  • ****
  • Posts: 412
    • http://www.astarot.tk
RE: starting external Programms with Tprocess
« Reply #1 on: August 17, 2005, 09:38:18 pm »
you must specify full path to executables IIRC, atleast try with /sbin/su or where su is if it works.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2584
RE: starting external Programms with Tprocess
« Reply #2 on: August 18, 2005, 03:03:26 pm »
You cannot use pipes in the command. You are running a process, not a bash shell.

if you put  
Code: [Select]

#!/bin/sh
echo " Question " | su -c "/etc/init.d/apache start"

in a script and run that, it probably will work.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

 

TinyPortal © 2005-2018