[Opensim-users] How do you start your OpenSim?
Daniel Frank
opensim-users-701436253 at danielfrank.net
Tue Dec 11 15:38:45 UTC 2012
Hello,
On 11.12.2012 16:12, Klaus-E. Klingner wrote:
> Hallo,
>
> how do you start your OpenSim/Robust-installation under linux so it runs
> under the correct user and the screen-console stays accessible?
>
> When I try to start after doing a "su opensim -c screen ....." and try
> to switch to the console I get "screen cannot open your terminal
> '/dev/pts/1' - please check". I have also tried putting the su into the
> command of the screen but it still does not work. The same occurs when
> my monit tries to restart it with user opensim configured.
I'm not using monit, so I cannot say about that, but this works for me
(in Ubuntu 12.04 LTS):
root at opensim:~# cat /etc/init/opensim.conf
start on (local-filesystems and net-device-up and runlevel [2345])
stop on runlevel [!2345]
pre-start exec /usr/bin/screen -p 0 -d -m -S opensim su - opensim -c "cd
/data/opensim/opensim/bin/ && /data/opensim/opensim/bin/OpenSim.exe"
post-stop script
PID=$(cat /data/opensim/opensim.pid)
screen -r opensim -p 0 -X stuff "shutdown$(printf \\r)"
while kill -0 $PID 2>/dev/null; do
sleep 1
done
exit 0
end script
You need a PID file of course or the stop will not work at all. Also
upstart does not monitor if it dies...
The screen options:
-d -m forks screen into the background and forces it to open a new session
-S opensim gives the screen session a name (screen -r opensim will
connect to it)
The screen command in the post-stop script sends the command "shutdown"
to opensim and therefore shuts down opensim normally.
The kill & sleep is just there to pause the shutdown of the system until
opensim has completely shutdown, which can take a couple of seconds. You
could extend it with a timeout, but I didn't go there.
Regards,
Daniel
More information about the Opensim-users
mailing list