<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>A question regarding the same:<br></div>I was wondering how attach_wait with run_command and run_shell works. Any description or documentation for the same?<br></div>When I am executing a shell script that I previously copied into the container file system with a hook for pre-start, I do it with attach_wait(lxc.attach_run_command,[script-path, args, ">", "file in the container", "2>&1"]),<br><br></div>1. I don't see the file with output in the container<br></div>2. If I redirect the output inside the script using > $HOME/file, I see $HOME pointing to my host home.<br><br></div>I would like to know the working of attach_wait to debug the same.<br></div>From the source I could get the following:<br></div>1. From attach_run_shell - it only starts a shell inside the container<br></div>How do I execute a program from this shell?<br><br></div>2. From attach_run_command- I can see it executes a process using execvp. So I assume the process is spawned from the host's namespace, hence $HOME still has host's home.<br></div>From this I inferred, I have to use $LXC_ROOTFS_PATH. How do I get the default username configured to login to the container?: <br>eg:${LXC_ROOTFS_PATH}/home/ubuntu<br><br><div>3. How to I pass arguments to the hook scripts? I know there are some environment variables passed and one can define environment variables using lxc.environment. But I do not wish to set environment variables but to pass arguments to the hook scripts.<br><br></div><div>Is there any documentation for attach_wait?<br></div><div>If not, I would volunteer for writing the same.<br><br></div><div>Thanks,<br></div><div>Heena<br></div><div><div><div><div><div><div><div><div><div><br></div></div></div></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 7, 2016 at 3:04 PM, Heena Sirwani <span dir="ltr"><<a href="mailto:heenasirwani@gmail.com" target="_blank">heenasirwani@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hi all,<br><br></div>How do I run attach_wait in quiet mode or redirect its output somewhere else?<br></div>I do not wish to see the output from my host. I redirect the output in the container. However, I see the output in the host from where the script is run.<br><br></div>Am I missing something?<br><br></div>Thanks,<br></div>Heena<br></div>
</blockquote></div><br></div>