Skip to main content
2 of 3
added 8 characters in body
Michael Homer
  • 78.9k
  • 17
  • 221
  • 239

echo $1 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