Reputation: 47357
I need to create a runit service that runs a gem's binary that was installed with rvm, the problem is that a non-login bash shell, which is how runit runs its services does not have the correct path's for rvm. Is there any automatic way of doing this?
Upvotes: 3
Views: 768
Reputation: 860
Does su - USERNAME -c '/path/to/script'
work? It should preserve the $PATH variables.
Upvotes: 1
Reputation: 462
I use following script:
#!/bin/sh
exec 2>&1
DIR=/var/www/apps/mega_app/current
export rvm_path=/usr/local/rvm
export rvm_ignore_rvmrc=1
cd $DIR
exec chpst -u user:group /usr/local/rvm/bin/rvm ree exec bundle exec ${DIR}/daemons/mega_daemon.rb
Upvotes: 6