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