=== Guest62484 is now known as rcj [20:21] does anybody have suggestions on how to detatch and run in background a command through runcmd? [20:21] nohup or cmd & [20:22] arksi, is cloud-init waiting if you use & ? [20:22] runcmd: [20:22] [ sh, -c, 'mycommand >/var/log/mycommand.log 2>&1 something to that effect [20:23] thanks [20:23] I will find out if it waits [20:23] I was trying [20:24] [ setsid, program, & ] [20:27] arksi, well that will probably just fail [20:27] It does ;) [20:27] as it will try to execute 'setsid' with the arguments: 'program' and '&' [20:27] I will try your recommendation and see how it goes [20:27] right [20:28] if you just quote it, it will pass it to shell [20:28] I didn't know we could use hardquotes like that [20:28] right [20:28] makes sense [20:28] good idea [20:28] ie, if the entry is a string it passes to shell [20:28] I will let you know how it works [20:28] right [20:28] [ /bin/sh, -c , ... ] [20:28] is clever [20:28] thanks a lot [20:28] just to be cleare, above: [20:28] runcmd: [20:28] Right [20:29] - "setsid program &" [20:29] - "another program" [20:29] Does runcmd spawn a subshell? [20:29] will do what you want. invoking sh -c 'setsid program' [20:29] spawn subshell and exec? [20:29] right [20:29] if its a string, it goes to shell [20:29] if its an array, no shell [20:29] ah [20:30] so it is equivalent to invoking system() if it is an array? [20:30] generally speaking i hate passing things to shell [20:30] :) [20:30] same heh [20:31] i would have though tsystem would go to a shell [20:32] you are right [20:32] system() invokes the shell and executes as a separate process [20:33] exec() family replaces the current process with the program being exec'd [20:33] system() = fork(), execve() and wait() [20:34] I have to run a stupid program that checks for runlevel heh [20:35] while cloud-init is running (on CentOS 7, at least), if you invoke runlevel command it reports 'unknown' [20:35] (why anybody in this century is still checking runlevels is a mystery to me...) [20:36] so 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 3 [20:36] horrible stuff :)