Eu recebi uma resposta do serverfault stackexchange. por Daniel t.
@ link
Citado:
The process ID is off by one because you have put an extra
&
after the$javaCommandLine
. In other words, you have put two processes in the background before callingecho $!
, thus getting the PID of>>$serviceLogFile 2>&1
rather than$javaCommandLine
. Those two pieces should be put in one, as the old 2 line codes showssu --session-command="$javaCommandLine & >>$serviceLogFile 2>&1 & echo \$! >$pidFile" $serviceUser || return 1
You might need to change it to -
su --session-command="$javaCommandLine >>$serviceLogFile 2>&1 & echo \$! >$pidFile" $serviceUser || return 1