[OpenIndiana-discuss] Advice for building SMF service for non-priviledged processes

Andrew Gabriel illumos at cucumber.demon.co.uk
Sat Jun 18 11:12:20 UTC 2011


Blake wrote:
> I am working on an SMF script to allow a non-root user to managed the
> Unicorn Ruby/Rails application server via SMF.  But I'm having problems.
>
> We are also using RVM to manage rubies, so I need a way for the method
> script to simulate an interactive login so that RVM works properly.
>
> Any ideas/suggestions much appreciated.
>   

I run mpd (music player daemon) as my userid via SMF.

I use the following start method to emulate enough of my login for it
to work:

<exec_method name='start' type='method' exec='/opt/local/bin/mpd' 
timeout_seconds='60'>
<method_context>
<method_credential user='andrew' group='staff'
privileges='basic' />
<method_environment>
<envvar name='HOME' value='/home/andrew' />
</method_environment>
</method_context>
</exec_method>

You may need to add more envvars for your app, or start it via a shell
script which does that for you.

-- 
Andrew



More information about the OpenIndiana-discuss mailing list