usage of exec in linino scripts

I was wondering why starting the bridge is so slow (I mean really minutes sometimes) so I looked at the bridge begin code.
I don't want to get started on that code but I noticed it basically started run-bridge on the linino site
As I had killed the bridge I ran run-bridge (which took long to get started) and took a look at the code

#!/bin/sh

cd /usr/lib/python2.7/bridge

exec python bridge.py 2> /tmp/bridge.py-stderr.log

:astonished: why exec? I checked the other scrips and exec is used to start python scripts.
Bash Reference Manual states:

If command is supplied, it replaces the shell without creating a new process.

This sounds scary to me :astonished:

should this not be

python bridge.py 2> /tmp/bridge.py-stderr.log &

Best regards
Jantje

exec is a BOURNE and POSIX shell command that replaces the current shell process with the command specified after exec and does not create a new PID. For example, if you were to run exec python bridge.py, the shell would be replaced by that command. When that command is exited the shell will exit.

My guess that is bridge function required.

I have run run-bridge from the command line.
That didn't stop my shell. I assume the bash runinng the script got replaced.

sonnyyu:
My guess that is bridge function required.

If so I'd really would like to know why. This because the bridge seems very unstable to me and takes ages to start. So I'm trying to find out what is going on here.
Looking at the code I see the bridge is started as follows:

// Bridge startup:
    // - If the bridge is not running starts it safely
    stream.print(CTRL_C);
    delay(250);
    stream.print(F("\n"));
    delay(250);
    stream.print(F("\n"));
    delay(500);
    // Wait for OpenWRT message
    // "Press enter to activate console"
    stream.print(F("run-bridge\n"));
    delay(500);
    dropAll();

So there must be a process running at the linino that starts a sh shell which gets replaced by pyton running the bridge.
Resulting in following questions

  1. Is this process documented?
  2. why is exec used?
  3. where is the time lost?

Best regards
Jantje