I have a script that starts a passenger standalone server for my rails app on boot. When I run this script from the command line it works as expected. However when its run by rc.local or crontab it will produce this error. I cant find any record of this for the life of me in any log file. Whats going on here and how can I fix it?

Some Specs:

Digital Ocean Droplet
Ubuntu 15.10: 32bit
Passenger Version: 5.0.27
Rails Version: 4.2.6
Ruby Version: 2.3.0

Once again this is a standalone server, there isn't a reverse proxy. I'am using iptables to redirect port 80 to the port passenger is on (Which is above 3000).

Any help would be greatly appreciated!


I figured this out I will leave this as answered for anybody else that has the same problem.

What Went Wrong

When I opened my digital ocean console so I could see the boot, I saw it was running my bootUp.sh script and trying to store th pid file in //passenger.PORT.pid note the two slashes. I thought that was pretty werird... As a novice I didn't know that the script in /path/to/my/script.sh wouldn't be executed in the directory it sat in. So when I ran the script from the root directory it produced a similar error.

How I fixed It

Turns out all I had to do was add the line cd /path/to/script/dir above the passenger start command I had in my script. The cd metioned above just put the working directory of the script where it should be because it defaulted somewhere else.

I hope this helps somebody else who isn't a expert at this kind of thing because it took me a long time to figure this simple mistake out

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.