4

My application can be launched via Terminal in linux OS as shell executable file. I have no issues while executing it normally, however when i execute it along with 'nohup' command , it logs below exception in 'nohup.out' file

`Exception in thread "Spring Shell" java.lang.IllegalStateException: Shell line reading failure
        at org.springframework.shell.core.JLineShell.promptLoop(JLineShell.java:541)
        at org.springframework.shell.core.JLineShell.run(JLineShell.java:179)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Ungültiger Dateideskriptor    this is in english “Invalid File Descriptor”
        at java.io.FileInputStream.read(Native Method)
        at jline.internal.NonBlockingInputStream.read(NonBlockingInputStream.java:169)
        at jline.internal.NonBlockingInputStream.read(NonBlockingInputStream.java:137)
        at jline.internal.NonBlockingInputStream.read(NonBlockingInputStream.java:246)
        at jline.internal.InputStreamReader.read(InputStreamReader.java:261)
        at jline.internal.InputStreamReader.read(InputStreamReader.java:198)
        at jline.console.ConsoleReader.readCharacter(ConsoleReader.java:2038)
        at jline.console.ConsoleReader.readLine(ConsoleReader.java:2242)
        at jline.console.ConsoleReader.readLine(ConsoleReader.java:2162)
        at jline.console.ConsoleReader.readLine(ConsoleReader.java:2150)
        at org.springframework.shell.core.JLineShell.promptLoop(JLineShell.java:522)
        ... 2 more
`

Now, as per my analysis, my application is based on spring shell and it tries to open/access the Terminal/Console initially while executing the application. But as nohup is used , standard input is redirected from /dev/null and hence my application tries to open/access /dev/null as Terminal and hence i get above exception.

Please can someone point me whether i am going in correct direction or not? and also is there any alternative for nohup command?

shardul
  • 61
  • 6

1 Answers1

0

You could try something like this:

nohup java -jar shell-app.jar 'spring shell command' > log.log 2>&1
djodar
  • 45
  • 6