How to automatically start Mango in a systemd based Linux OS
Some Linux distributions as CentOS or RedHat are migrating from systemV init type to the newest systemd.
If this is your case, you will need to do as follow to make Mango runs with every system startup:
Create a mango.service file:
chmod 664 /etc/systemd/system/mango.service
Edit the new file so it contains the following:
Description=Mango Daemon Service
NOTE: You will need to point the mango directory path to whatever your MA_HOME is.
Reload systemd configuration files:
Add mango to systemd, so it runs on every system startup:
systemctl enable mango.service
That's it. Now you can manage the Mango service with the following shell commands:
systemctl [start|stop|reload|status] mango
Editted by Phil: original PIDFile entry --> PIDFile=/opt/ambilogger/bin/ma.pid, edited from ambiguity in: https://forum.infiniteautomation.com/topic/3179/centos-7-systemd-startup-failing
Jared Wiltshire last edited by
I'll add an Upstart script for Ubuntu, I have been using this with Ubuntu 14.04. This one lets you run mango as a non-root user. Restart doesn't work too well as ma-stop.sh doesn't stop Mango immediately.
From Ubuntu 15.04 onwards systemd is used instead of Upstart so dont use this script.
# mango - Mango Automation # # Mango Automation is a Java web app for monitoring and logging data sources description "Mango Automation" start on (local-filesystems and net-device-up IFACE=eth0) stop on runlevel [!2345] #respawn #respawn limit 10 5 umask 002 setuid mango setgid mango env MA_HOME=/opt/mango export MA_HOME console log script . "$MA_HOME"/bin/ma-init.sh export JPDA EXECJAVA JAVAOPTS SYSOUT SYSERR exec "$MA_HOME"/bin/ma-start.sh end script pre-stop script "$MA_HOME"/bin/ma-stop.sh end script
Hi Jared I am wondering if you would generate a systemd script for our Ubuntu 16.04 LTS and show it here as the one provided above complains of an error when I tried this script in our system?
I Appreciate any help on this.
dan last edited by
@aoliver This worked for me on a RPi3 thanks!
dan last edited by
although, this PIDFile=/opt/ambilogger/bin/ma.pid should be /opt/mango/bin ;-)