Starting god as deploy user

363 Views Asked by At

I have an init.d script to start up god on my server after a reboot.

I've run sudo chmod +x /etc/init.d/god and sudo update-rc.d -f god defaults and when I run /etc/init.d/god start as the deploy user I have no issues and god starts.

However, when I reboot the server god doesn't start.

When I try and start god manually as root I get this error:

Your Ruby version is 1.9.3, but your Gemfile specified 2.3.0

I believe the issue is something to do with root not having rvm or ruby 2.3.0. Is there a way to run the init.d script as deploy?

I'm on Ubuntu 14.04, ruby 2.3.0 and god 0.13.7

1

There are 1 best solutions below

2
Steve Benner On

You can run any command (or execute a script) as any user with the sudo command; just use the -u flag to specify the user. Example:

sudo -u deploy /etc/init.d/god

See more here: http://www.sudo.ws/man/1.8.15/sudo.man.html