Linux Service with sytemd

From OpenSimulator

Revision as of 12:00, 22 November 2012 by Gsusin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Tested with OpenSuse 12.2 and OpenSim 0.7.4 in standalone mode.

Configuration

Prerequisites: OpenSim is installed in /srv/opensim/ and is owned by user "opensim".

Create a file with service definition in /lib/systemd/system/opensim.service:

[Unit]
Description=OpenSim Service
After=syslog.target network.target

[Service]
User=opensim
WorkingDirectory=/srv/opensim/bin
ExecStart=/usr/bin/screen -S OpenSimService -D -m mono OpenSim.exe -gui=true
ExecStop=/usr/bin/screen -d -r OpenSimService -X stuff "shutdown" ; /usr/bin/screen -d -r OpenSimService -X eval "stuff ^M"
KillMode=none

[Install]
WantedBy=multi-user.target

Then add it to systemd and start it:

systemctl enable  opensim.service
systemctl start  opensim.service

The service should be running now.

If you want to type commands in the server console, just attach the screen:

su opensim -c 'screen -r OpenSimService'

To detach the screen, type "CTRL + a + d".

Personal tools
General
About This Wiki