/srv/irclogs.ubuntu.com/2015/02/26/#cloud-init.txt

=== Guest62484 is now known as rcj
arksidoes anybody have suggestions on how to detatch and run in background a command through runcmd?20:21
harmwnohup or cmd &20:21
smoserarksi, is cloud-init waiting if you use & ?20:22
smoserruncmd:20:22
smoser [ sh, -c, 'mycommand >/var/log/mycommand.log 2>&1 </dev/null &' ]20:22
smosersomething to that effect20:22
arksithanks20:23
arksiI will find out if it waits20:23
arksiI was trying20:23
arksi[ setsid, program, & ]20:24
smoserarksi, well that will probably just fail20:27
arksiIt does ;)20:27
smoseras it will try to execute 'setsid' with the arguments: 'program' and '&'20:27
arksiI will try your recommendation and see how it goes20:27
arksiright20:27
smoserif you just quote it, it will pass it to shell20:28
arksiI didn't know we could use hardquotes like that20:28
arksiright20:28
arksimakes sense20:28
arksigood idea20:28
smoserie, if the entry is a string it passes to shell20:28
arksiI will let you know how it works20:28
arksiright20:28
arksi[ /bin/sh, -c , ... ]20:28
arksiis clever20:28
arksithanks a lot20:28
smoserjust to be cleare, above:20:28
smoserruncmd:20:28
arksiRight20:28
smoser - "setsid program &"20:29
smoser - "another program"20:29
arksiDoes runcmd spawn a subshell?20:29
smoserwill do what you want. invoking sh -c 'setsid program'20:29
arksispawn subshell and exec?20:29
arksiright20:29
smoserif its a string, it goes to shell20:29
smoserif its an array, no shell20:29
arksiah20:29
arksiso it is equivalent to invoking system() if it is an array?20:30
smosergenerally speaking i hate passing things to shell20:30
smoser:)20:30
arksisame heh20:30
smoseri would have though tsystem would go to a shell20:31
arksiyou are right20:32
arksisystem() invokes the shell and executes as a separate process20:32
arksiexec() family replaces the current process with the program being exec'd20:33
arksisystem() = fork(), execve() and wait()20:33
arksiI have to run a stupid program that checks for runlevel heh20:34
arksiwhile cloud-init is running (on CentOS 7, at least), if you invoke runlevel command it reports 'unknown'20:35
arksi(why anybody in this century is still checking runlevels is a mystery to me...)20:35
arksiso I cannot invoke this program directly through cloud-init, hence I am trying to get it to detatch from init process and run in the background after waiting for runlevel 320:36
arksihorrible stuff :)20:36

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!