I have a program that needs to be run in about 1000 instances, each in a different independent directory (/mnt/x_1, /mnt/x_2... /mnt/x_1000). What I'm currently doing is mounting /bin /dev and /etc in each directory, then copying bash-related libraries from /lib and /lib64 to each directory and running those processes in for loop with subshell:

for (1..1000):
(cd /mnt/x_$1; chroot .; ./app)

But there are some problems:

  1. After each iteration I have to press ctrl+x(exit), because chroot changes user to "I have no name" and nothing else can be done. The processess are starting though
  2. It is NOT stable, it can NOT be ran from startupscript in terraform environment
  3. Sometimes it doesn't start at all and hangs the system

The trick is that from ansible it works like a charm, but I can not use ansible in this env.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.