How to run groovy script in background?


Phate <phat...@...>
 

Hi all, is it possible run gremlin.sh in background? 
I try to use `-e` argument to run a groovy script, and always change to stopped status, but it can finish when change to in foreground.

```
[bin]$ touch test.groovy
[bin]$ ./gremlin.sh -e test.groovy &
[1] 21385
[bin]$ 

[1]+  Stopped                 ./gremlin.sh -e test.groovy
[bin]$ fg
./gremlin.sh -e test.groovy
```

I found there a `stty` process, but redirect stdout to file and `stty -tostop` were not work.

```
[bin]$ ps
  PID TTY          TIME CMD
21347 pts/4    00:00:00 bash
21485 pts/4    00:00:06 java
21541 pts/4    00:00:00 ps
[bin]$ 

[1]+  Stopped                 ./gremlin.sh -e test.groovy
[bin]$ ps
  PID TTY          TIME CMD
21347 pts/4    00:00:00 bash
21485 pts/4    00:00:12 java
21545 pts/4    00:00:00 stty
21546 pts/4    00:00:00 ps
```
Same problem on CentOS7 and docker container, any idea how to solve it?


HadoopMarc <bi...@...>
 

You could end your script with:

System.exit(0)

HTH,    Marc

Op woensdag 9 december 2020 om 04:16:43 UTC+1 schreef Phate:

Hi all, is it possible run gremlin.sh in background? 
I try to use `-e` argument to run a groovy script, and always change to stopped status, but it can finish when change to in foreground.

```
[bin]$ touch test.groovy
[bin]$ ./gremlin.sh -e test.groovy &
[1] 21385
[bin]$ 

[1]+  Stopped                 ./gremlin.sh -e test.groovy
[bin]$ fg
./gremlin.sh -e test.groovy
```

I found there a `stty` process, but redirect stdout to file and `stty -tostop` were not work.

```
[bin]$ ps
  PID TTY          TIME CMD
21347 pts/4    00:00:00 bash
21485 pts/4    00:00:06 java
21541 pts/4    00:00:00 ps
[bin]$ 

[1]+  Stopped                 ./gremlin.sh -e test.groovy
[bin]$ ps
  PID TTY          TIME CMD
21347 pts/4    00:00:00 bash
21485 pts/4    00:00:12 java
21545 pts/4    00:00:00 stty
21546 pts/4    00:00:00 ps
```
Same problem on CentOS7 and docker container, any idea how to solve it?