Skip to main content
3 of 3
edited title
jbeaulau
  • 61
  • 1
  • 1
  • 3

echo $! after starting process no PID

I have an init script that executes a jar file in the background, and I want to print the PID to a file. Using the following immediately after the execute command the file is created, but it is empty.

start process & \
echo $! >/var/run/foo.pid

Why might this be? Thanks

jbeaulau
  • 61
  • 1
  • 1
  • 3