Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 650
fish potato Avatar asked Jan 19 '12 06:01

fish potato


1 Answers

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.

like image 72
edk750 Avatar answered Sep 21 '22 11:09

edk750