From: ara.t.howard@... Date: 2007-01-03T03:25:22+09:00 Subject: Re: "su user -c 'command'" from within ruby On Wed, 3 Jan 2007, Moritz Reiter wrote: > Wim, thanks for your reply and sorry that it took me so long to reply again. > > Wim Vander Schelden wrote: >> Are you sure your command returns? Maybe it blocks until the process >> ends? Is there any information you could give on the command you are >> trying to execute? > > This is what I want to do: > > port = 24800 > synergy_client = "synergyc" > pattern = "^ssh.*#{port}" > > pid = %x{pgrep -f #{pattern}} > %x{kill #{pid}} if pid != 0 and pid != nil and pid != "" # # use Process.kill # > > cmd = "su #{USER} -c \"ssh -f -N -L \ > #{port}:#{@site.synergy_server}:#{port} #{@site.synergy_server}\"" # # use Net::SSH # > > # this one gets executed but nothing afterwards... > %x{#{cmd}} this is probably blocking and asking for password. perhaps you don't have keys or your agent running properly? because you are using backticks/%x any stdout, such as a password prompt, will be lost. just by changing this to 'system' you should be able to see if this is the case. in any case i'm guessing this is a env/ssh issue rather than a ruby one. regards. -a -- if you find yourself slandering anybody, first imagine that your mouth is filled with excrement. it will break you of the habit quickly enough. - the dalai lama