pct exec and daemonizing

Nov 17, 2017
16
0
6
60
I wish to launch a script on a collection of containers. pct exec seems to do what I want. Except I want to background my script and have the pct exec finish immediately. I tried just adding an & (ampersand) but when the pct exec finishes, it terminates the backgrounded script. I have now tried with the daemonize utility from http://software.clapper.org/daemonize/ and still my scripts seem to be terminated as soon as pct exec finishes. There is very little documentation I can find on precisely what/how pct exec works - and, in particular, what are the implications on spawned processes when the exec returns control flow back to the host. Any pointers would be appreciated.
 
Please use ssh for such things. That way, started script belong to the container and works as expected.
Maybe together with some automation toolkit like ansible.
 
An ssh approach does work. It would be nice if the pct documentation included something like "pct exec has restrictions compared to, say, an ssh approach. Notably, the execution environment in the container ceases to exist when pct exits."