The PID file for this statement is created but it is always empty. When running the shell with -x I see that $! empty, yet at the end the java job is left running in the background as desired. Why is the pid missing?
su - $USER -c "nohup java $rest_api_opts -jar $app_home/$app_name \
> /dev/null 2>&1& echo $! > $PID"