I specify the location of pid file in rails s
command by appending --pid
option.
rails s -d --pid ~/foo.pid
To stop the server, I use the following code.
kill -9 $(cat ~/foo.pid)
The problem is, the pid file created by the first command is found at /foo.pid
, not ~/foo.pid
.
How can I specify the pid file path in relative path in rails s
command?
From a standard shell (bash)
$ rails s -d --pid `pwd`/foo.pid
The backticks execute the pwd (print working directory) command and substitutes the output in that spot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With