Github user ijokarumawak commented on the issue:
https://github.com/apache/nifi/pull/1523
I tested this PR on Ubuntu to confirm below:
1. 'exec' works as NIFI-2689 expected.
2. Don't break NIFI-3294, nifi-env.sh being used properly with 'run.as'
configuration.
3. 'restart' and other execution mode works properly.
To demonstrate how 'exec' changes process tree, I run `nifi.sh run`
with/without `exec` command in nifi.sh:
```bash
# Without exec
2934 pts/0 Ss 0:00 | \_ -bash (login as 'ubuntu' user and use
sudo to run the shell as root)
8424 pts/0 S+ 0:00 | \_ sudo
/opt/nifi-1.2.0-SNAPSHOT/bin/nifi.sh run
8425 pts/0 S+ 0:00 | \_ /bin/sh
/opt/nifi-1.2.0-SNAPSHOT/bin/nifi.sh run
8439 pts/0 Sl+ 0:00 | \_ /usr/bin/java -cp
/opt/nifi-1.2.0-SNAPSHOT/conf:/opt/nifi-1.2.0-SNAPS
8452 pts/0 Sl+ 0:09 | \_ java -classpath
/opt/nifi-1.2.0-SNAPSHOT/./conf:/opt/nifi-1.2.0-S
# With exec
2934 pts/0 Ss 0:00 | \_ -bash
8306 pts/0 S+ 0:00 | \_ sudo
/opt/nifi-1.2.0-SNAPSHOT/bin/nifi.sh run
8307 pts/0 Sl+ 0:00 | \_ /usr/bin/java -cp
/opt/nifi-1.2.0-SNAPSHOT/conf:/opt/nifi-1.2.0-SNAPSHOT/
8333 pts/0 Sl+ 0:12 | \_ java -classpath
/opt/nifi-1.2.0-SNAPSHOT/./conf:/opt/nifi-1.2.0-SNAPS
```
```bash
# Without execk
2934 pts/0 Ss 0:00 | \_ -bash
7799 pts/0 S+ 0:00 | \_ sudo
/opt/nifi-1.2.0-SNAPSHOT/bin/nifi.sh run
7800 pts/0 S+ 0:00 | \_ /bin/sh
/opt/nifi-1.2.0-SNAPSHOT/bin/nifi.sh run
7815 pts/0 S+ 0:00 | \_ sudo -u nifi sh -c
SCRIPT_DIR='/opt/nifi-1.2.0-SNAPSHOT/bin' && . '/o
7816 pts/0 S+ 0:00 | \_ sh -c
SCRIPT_DIR='/opt/nifi-1.2.0-SNAPSHOT/bin' && . '/opt/nifi-1
7818 pts/0 Sl+ 0:00 | \_ /usr/bin/java -cp
/opt/nifi-1.2.0-SNAPSHOT/conf:/opt/nifi-1.2
7831 pts/0 Sl+ 0:10 | \_ java
-classpath /opt/nifi-1.2.0-SNAPSHOT/./conf:/opt/nifi
# With exec
2934 pts/0 Ss 0:00 | \_ -bash
7922 pts/0 S+ 0:00 | \_ sudo
/opt/nifi-1.2.0-SNAPSHOT/bin/nifi.sh run
7923 pts/0 S+ 0:00 | \_ sudo -u nifi sh -c
SCRIPT_DIR='/opt/nifi-1.2.0-SNAPSHOT/bin' && . '/opt/n
7938 pts/0 S+ 0:00 | \_ sh -c
SCRIPT_DIR='/opt/nifi-1.2.0-SNAPSHOT/bin' && . '/opt/nifi-1.2.0
7940 pts/0 Sl+ 0:00 | \_ /usr/bin/java -cp
/opt/nifi-1.2.0-SNAPSHOT/conf:/opt/nifi-1.2.0-S
7953 pts/0 Sl+ 0:04 | \_ java -classpath
/opt/nifi-1.2.0-SNAPSHOT/./conf:/opt/nifi-1.2
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---