How do I call a process with `exec` that wont show up twice in top?

when I run docker exec --user root btc-server btc cpulimit -l 20 -q -- nice -n 19 bitcoind -datadir=/home/BTC/data -daemon 1> /dev/null $3 $4 $5 &

I see in top

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                    
1823899 root      39  19       0      0      0 Z   0.0   0.0   0:00.00 bitcoind                                                                
1823901 root      39  19 3248028 840572 137932 S   0.0   1.3   1:33.63 bitcoind

You can see that it appears twice and that one instance looks weird.

So I googled ubuntu top Process Status Z and it says

Z’ is a state where the process is dead (it has finished its execution) , and the only thing left is the structure describing it on the kernel. It is waiting for its parent process to retrieve its exit code, and not much more. After its parent process is finished with it, it will disappear

so how do I call a process with exec so that it wont be waiting like this?

Docker is waaaaaaaay better for me than LXD by the way #loveIt!

Are you sure the process is not created by your entrypoint script?

Great to hear!

Just keep in mind, that both container technologies aim for a different type of virtualization. Docker provides application virtualization, while LXD provides OS level virtualization. None of both provides machine virtualization.

1 Like

Are you sure the process is not created by your entrypoint script?

I forgot to mention that the command is inside a script I made /usr/bin/btc and that I call it like so

btc d on

and it runs like so

elif [ "$1 $2" = "d on" ]
then
  bash -c "rm -f /home/BTC/tx.js /home/BTC/block.js || true"
  docker exec --user root btc-server cpulimit -l 20 -q -- nice -n 19 bitcoind -datadir=/home/BTC/data -daemon 1> /dev/null $3 $4 $5 &

If I switch the daemon off, then run the same command again I get another Z process

1815465 root      39  19       0      0      0 Z   0.0   0.0   0:00.01 bitcoind                                                                
1859742 root      39  19       0      0      0 Z   0.0   0.0   0:00.01 bitcoind                                                                 
1859745 root      39  19 2795760 347896  40572 S  41.5   0.5   0:08.24 bitcoind

I’m going to add the -t flag for tty
or maby the -i flag for interactive

You need to wait till someone comes around that actually uses nice.

The only thing that comes kind of close to it is to set relative weight using cpu-shares to prioritize amongst containers that have--cpu-shares set. Unlike nice, it will not affect containers without the --cpu-shares setting or host processes. By default, Docker tries to evenly share the cpu time amongst all containers.