I've got a command in a shell script:
php ./script.php > output.txt & echo $! > script.pid
This results in my script launching as a background process with output routed to output.txt and the process id of this script being written to script.pid.
I'd like to make another shell script which will read the pid from script.pid and kill that process. I tried this but it didn't work:
Mac:server sneakyimp$ sudo kill -9 < cat script.pid
-bash: cat: No such file or directory
Mac:server sneakyimp$ sudo kill -9 < `cat script.pid`
-bash: 85412: No such file or directory
I read the man pages for kill and didn't see anything about reading the pid from stdin.