NOTE: As of November 2019, these instructions are outdated and should not be used for new installations. Please see the relevant section of the Linux installation document.

These instructions are for Debian and Linux-based systems

Installing a service for Linux can be very useful if you want to start, stop, or even restart mango.

With that said, a full Linux service tutorial is out of the reach of this wiki. But please feel free to look at these links:

https://wiki.debian.org/LSBInitScripts
https://wiki.debian.org/Daemo

http://debian-handbook.info/browse/stable/unix-services.html

Service Install Instructions

cd /etc/init.d
sudo nano mango

Add this code to the file

Please note that if you have mango installed at a location other than: /opt/mango you will need to change the start and stop variables to your full path in which mango is installed.

 
#!/bin/sh
# chkconfig: 235 99 10
# description: Start or stop the Mango Automation
#
### BEGIN INIT INFO
# Provides: mango
# Required-Start: $network $syslog
# Required-Stop: $network
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Description: Start or stop the Mango Automation
### END INIT INFO
start="/opt/mango/bin/ma.sh start"
stop="/opt/mango/bin/ma.sh stop"
lockfile=/var/lock/subsys/mango
name='Mango'
case "$1" in
'start')
$start>/dev/null 2>&1 </dev/null
RETVAL=$?
if [ "$RETVAL" = "0" ]; then
touch $lockfile>/dev/null 2>&1
fi
;;
'stop')
$stop
RETVAL=$?
if [ "$RETVAL" = "0" ]; then
rm -f $lockfile
fi
;;
'status')
status Mango
;;
'restart'|'reload'|'condrestart')
$stop ; $start
RETVAL=$?
;;
*)
echo "Usage: sudo service{ start | stop | restart | reload | condrestart}"
RETVAL=1
;;
esac
exit $RETVAL
 

Press ctrl+x then save the file

Next we need to set the permissions for the service to be excludable

sudo chmod u+x /etc/init.d/mango

Next we need to tell the system about this on Debian-based systems (Ubuntu, Linux Mint, ect.)

sudo  update-rc.d  mango defaults

That's it! You can now start and stop the services like so:

stop

sudo service mango stop

start
restart

sudo service mango restart

status

sudo service mango status

Windows Service

We recommend using YAJSW for installing a windows service. We are providing a prepackaged file to make this very easy:

  1. Download the zip file yajsw.zip Unzip the fine in your MA_HOME folder.

  2. Inside the MA_HOME/yajsw/conf/wrapper.conf file you can edit the location where Mango is installed. By default it assumes Mango is installed at C:\Mango

  3. In the command prompt cd to MA_HOME\yajsw\bat and they run installService.bat.

  4. After the service is installed you can open up your windows services screen and start or stop the service named Mango.

Note: When running as a windows service in this way the automatic upgrade of the Mango core will not fully complete and you will have to finish the upgrade manually by deleting the MA_HOME\lib folder and unzipping the m2m2-core.x.x.x.zip file that will be downloaded during the upgrade process.