From: Moritz Reiter Date: 2006-11-24T17:16:30+09:00 Subject: Re: invoke system command from within a method -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jan Svitok wrote: > More blind tips: > > 1. try adding code to that %x{...} in smaller chunks: > (without class & puts, add method) def restart ; %x{...} ; end > (without method and class, add puts) > (add puts and method) Okay, I tried a few cases: The init script does not get processed correctly no matter if it's in a class or just in a method or just at very end of my whole script without puts or anything. BUT if put the very same statment ( %x{ /etc/init.d/networking restart } into a separate file as the only statement of the file (besides the hash bang...) and execute this file, the init script does reconfigure my eth correctly. I am mostly greatly confused... > 2. I suspect stderr might be a problem. Try adding 2>/dev/null That does not change the behaviour. > 3. Try adding sh before the command Neither does this. > 4. Have a look at the actual script and see what could be a problem. > Optionally add some traces there to see how far does it get. I looked into the script already. It does not much more than calling ifdown -a --exclude=lo ifup -a --exclude=lo and some logging. I added 'set -x' to the beginning of the init script and the output does not look different. Only difference is that in once case my eth gets the new IP, in the other it doesn't. So I suspect that the problem is connected more to the ifdown/ifup binaries than to the init script itself. > 5. The documentation is at Kernel#`, and the ultimate documentation is > in /usr/local/src/ruby/io.c, function rb_f_backquote() ;-) ri Kernel#\` does not reveal much info. Will have a look into API documentation or something. I don't have much hope to understand much of io.c as I never coded a single line of C :-/ Maybe you or someone else have another idea after my information update? - -- Moritz Reiter GPG key fingerprint: https://luna.agrav.org/~mo/gpg/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFZqpFwR2rA+A/LU4RAgmdAKCd5zpyJ+1Lied4mmm5v/I0Zl8W0wCfRCTk 6+r8DbO6x9gZaDjulmqGrmg= =Ncj8 -----END PGP SIGNATURE-----