• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    CentOS 7 systemd Startup Failing

    How-To
    2
    6
    2.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • thutchisT
      thutchis
      last edited by thutchis

      I followed the directions for adding Mango to a CentOS 7 systemd service startup. Unfortunately when I use "systemctl start mango" it fails with a "Job for mango.service failed because a timeout was exceeded. See "systemctl status mango.service" and "journalctl -xe" for details."

      I added a "TimeoutSec=250" to the Service section of the mango.service file. But it still times out. I think this is because the startup script is not exiting properly so systemd keeps waiting for the service to start. If I run the "ma.sh start" script from a command line, it doesn't return to a command prompt until I hit "return".

      The last line in the ma.log file is: "INFO 2018-01-01T10:17:22,046 (org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler:362) - Mapped URL path [/sqlConsole.shtm] onto handler of type [class com.serotonin.m2m2.web.mvc.UrlHandlerController]"

      Any ideas?

      Re: How to automatically start Mango in a systemd based Linux OS

      Craft Malt from the Ground Up

      1 Reply Last reply Reply Quote 0
      • phildunlapP
        phildunlap
        last edited by phildunlap

        Hi thutchis,

        That last line is typical of a successful boot. Are you sure that is a result of trying to execute the service?

        There is nothing in the ma.sh script to pause until a key is pressed. I think you are maybe not seeing the new shell line it printed because there is all the Mango output competing with it for your eyes, then you're hitting return to get another still.

        Are you passing anything as input in your service? In our service file on the MangoES we control the standard streams as such: /path/to/Mango/bin/ma.sh start >/dev/null 2>&1 </dev/null

        thutchisT 1 Reply Last reply Reply Quote 0
        • thutchisT
          thutchis @phildunlap
          last edited by thutchis

          @phildunlap

          Thanks for the reply Phil,

          Yes, that is the result of "sysctl start mango"

          You were right, if I use "ma.sh>/dev/null 2>&1</dev/null start" as root/sudo on the command line I do get a new command line prompt immediately. So something else isn't letting systemd know the script (and Mango startup) was successful.

          Here is my /etc/systemd/system/mango.service file:

          [Unit]
          Description=Mango Daemon Service
          After=network.target
          After=network-online.target

          [Service]
          Type=forking
          ExecStart=/opt/mango/bin/ma.sh start>/dev/null 2>&1 </dev/null
          ExecStop=/opt/mango/bin/ma.sh stop>/dev/null 2>&1 </dev/null
          ExecReload=/opt/mango/bin/ma.sh restart>/dev/null 2>&1 </dev/null
          PIDFile=/opt/ambilogger/bin/ma.pid
          TimeoutSec=250

          [Install]
          WantedBy=multi-user.target

          Craft Malt from the Ground Up

          1 Reply Last reply Reply Quote 0
          • phildunlapP
            phildunlap
            last edited by

            Maybe you could direct your stdout and stderr to a file to see what's going on.

            ExecStart=/opt/mango/bin/ma.sh start>/opt/mango/logs/service.log 2>&1 </dev/null

            You'll just want to set this back once it's working or that file could consume the whole disk if the log output ever explodes.

            thutchisT 1 Reply Last reply Reply Quote 0
            • thutchisT
              thutchis @phildunlap
              last edited by

              @phildunlap
              Thanks again Phil,

              Problem solved. I blindly followed the instructions at https://forum.infiniteautomation.com/topic/2246/how-to-automatically-start-mango-in-a-systemd-based-linux-os and didn't read the entire thread. In the [Service] section of the mango.service file it says to put "PIDFile=/opt/ambilogger/bin/ma.pid". I don't know what "ambilogger" is and there isn't a directory "/opt/ambilogger" so the startup script would fail. The last entry in the thread corrected that to "PIDFile=/opt/mango/bin/ma.pid". I fixed the line in the "mango.service" file and now it works. Sheesh.

              Craft Malt from the Ground Up

              1 Reply Last reply Reply Quote 0
              • phildunlapP
                phildunlap
                last edited by

                Ah! Thanks for sharing what the cause and solution were. I went back and edited that post so that Dan's suggestion (this issue) was /opt/mango/bin/ma.pid in the original post

                Glad you got it working!

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post