Shortnote

The following init script will handle an OpenSim instance on Debian systems. The script assumes that an user opensim was created on the system using adduser and that the OpenSim.exe executable is located in the opensim user's home at "bin/OpenSim.exe".

The following file should be placed at /etc/init.d/opensim and the commands:

/etc/init.d/opensim start

can be used to start the daemon, respectively

/etc/init.d/opensim stop

can be used to stop the daemon.

Code

This script was used on Debian Squeeze 6.0.6!

opensim
#!/bin/sh
### BEGIN INIT INFO
# Provides: opensim
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: false
# Short-Description: opensim service
### END INIT INFO
 
#opensim service
OPENSIM_USER="opensim"
 
DAEMON="OpenSim.exe"
 
start() {
   echo "Starting opensim..."
   HOMEDIR=`getent passwd $OPENSIM_USER | cut -d: -f6`
   if [ -x $HOMEDIR/bin/$DAEMON ]; then
       HOME="$HOMEDIR" start-stop-daemon --start -c $OPENSIM_USER --pidfile $HOMEDIR/bin/OpenSim.pid --make-pidfile --exec /usr/bin/mono -d $HOMEDIR/bin --background -- $HOMEDIR/bin/OpenSim.exe -console=reset -background=true
   fi
}
 
stop() {
   echo "Stopping opensim..."
   HOMEDIR=`getent passwd $OPENSIM_USER | cut -d: -f6`
   if [ -x $HOMEDIR/bin/$DAEMON ]; then
       start-stop-daemon -o -c $OPENSIM_USER -K -u $OPENSIM_USER --pidfile $HOMEDIR/bin/OpenSim.pid -x /usr/bin/mono -- $HOMEDIR/bin/OpenSim.exe -console=rest -background=true
   fi
}
 
status() {
 
   dbpid=`pgrep -u $OPENSIM_USER opensim`
   if [ -z $dbpid ] ; then
       echo "opensim for USER $OPENSIM_USER: not running."
   else
       echo "opensim for USER $OPENSIM_USER: running (pid $dbpid)"
   fi
 
}
 
case "$1" in
 
   start)
       start
       ;;
   stop)
       stop
       ;;
   restart|reload|force-reload)
       stop
       start
       ;;
   status)
       status
       ;;
   *)
       echo "Usage: /etc/init.d/opensim {start|stop|reload|force-reload|restart|status}"
       exit 1
 
esac
 
exit 0

opensim/restarters/systemv/opensim.txt ยท Last modified: 2022/04/19 08:28 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.