Autorestart With Upstart

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (Removed 'Template:' prefix from template includings and/or changed external-link into internal-link)
m (Robot: Cosmetic changes)
Line 2: Line 2:
 
{{Quicklinks}}
 
{{Quicklinks}}
  
==What is upstart?==
+
== What is upstart? ==
  
 
From the official description:
 
From the official description:
Line 11: Line 11:
  
  
==Monitoring/restarting OpenSim with upstart==
+
== Monitoring/restarting OpenSim with upstart ==
  
The following assumes you're running OpenSim within GNU screen, so one can detach and reattach to the console. But that's not required to use upstart.
+
The following assumes you're running OpenSim within GNU screen, so one can detach and reattach to the console. But that's not required to use upstart.
  
 
Create a file, <tt>/etc/event.d/opensim</tt> , containing the following:
 
Create a file, <tt>/etc/event.d/opensim</tt> , containing the following:

Revision as of 19:01, 3 March 2012

What is upstart?

From the official description:

Upstart is an event-based replacement for the /sbin/init daemon which handles starting of tasks and services during boot, stopping them during shutdown and supervising them while the system is running.
It was originally developed for the Ubuntu distribution, but is intended to be suitable for deployment in all Linux distributions as a replacement for the venerable System-V init.


Monitoring/restarting OpenSim with upstart

The following assumes you're running OpenSim within GNU screen, so one can detach and reattach to the console. But that's not required to use upstart.

Create a file, /etc/event.d/opensim , containing the following:

 start on runlevel [!06]
 stop on runlevel [06]

 exec /bin/su - opensim -c '/usr/bin/screen -h 0 -D -m -c /var/run/opensim/opensim.screenrc'
 respawn

 # give up if I respawn 3 times in 60 seconds...
 respawn limit 3 60

Create a file, /var/run/opensim/opensim.screenrc , containing the following:

chdir /usr/lib/opensim/bin
screen -h 500 -t opensim mono OpenSim.exe -gui=true

Then, to start or stop OpenSim, just use:

# start opensim

or:

# stop opensim

If OpenSim dies on its own, upstart will automatically restart it.

Personal tools
General
About This Wiki