How to specify pid file in relative path in rails server command

I specify the location of the pid file in the rails s command by adding the --pid .

rails s -d --pid ~/foo.pid

To stop the server, I use the following code.

kill -9 $(cat ~/foo.pid)

The problem is that the pid file created by the first command is in /foo.pid , not ~/foo.pid .

How can I specify the pid file path in relative path in rails s command?

+4
source share
1 answer

From the standard shell (bash)

 $ rails s -d --pid `pwd`/foo.pid 

The reverse steps execute the pwd (print working directory) command and replace the output at that location.

+6
source

Source: https://habr.com/ru/post/1391776/


All Articles