Welcome Guest! Log in
Due to some maintenance operations, stambia.org will be switched to read-only mode during the 13th November. It will be possible to read and download, but impossible to post on the forums or create new accounts. For any question please contact the support team.


Here is a sample init.d script for executing the Runtime as a Linux service.

This sample script should be adapted to your specific Linux distribution, server architecture and enterprise best practices.
Please consult your Linux distribution's docs to know how to install and register a service.

Sample script

This sample script executes the Runtime as the "stambia" user. Please adapt it to your particular needs (directory, runtime port, user...).

We have created this script in file /etc/init.d/stambiaRuntime

And then we registered the service for startup with this command: sudo update-rc.d stambiaRuntime defaults

#!/bin/sh

# runtime install dir
export dir=/data/stambiaRuntimeSupport

# runtime port - necessary for stopping the runtime
export port=42000

start()
{
  su - stambia -c "cd $dir;nohup ./startengine.sh &"
}

stop()
{
  su - stambia -c "cd $dir;./stopengine.sh -port $port"
}

restart()
{
    stop;
    sleep 1;
    start;
}

case $1 in
start)
  start;;
stop)
  stop;;
restart)
  restart;;
*)
  start;;
esac

Starting / Stopping the service

Simply replace "stambiaRuntime" with your init.d script name:

$ sudo service stambiaRuntime start
$ sudo service stambiaRuntime stop
$ sudo service stambiaRuntime restart

 

 

 

You have no rights to post comments

Articles

Suggest a new Article!