Linux Service in Debian 10
-
Hi,
I have installed Mango Automation software v3.6.4 on a HP Stream 13 with Debian 10 (64 Bit version) and Open JDK 11.0.4.
I can manually start Mango software from terminal without problem.
I ran into trouble when i tried to setup Linux Service. I found a similar problem on the forum which has a status code of 126 but mine
has got status code of 127.
Below is what i have encountered:
I followed the instructions on how to setup a Linux service and when i ran the status command, below is what i get from the terminal:
-
Aug 05 21:50:50 debian-mango systemd[1]: Starting LSB: Start or stop the Mango Automation...
Aug 05 21:50:50 debian-mango systemd[1]: mango.service: Control process exited, code=exited, status=127/n/a
Aug 05 21:50:50 debian-mango systemd[1]: mango.service: Failed with result 'exit-code'.
Aug 05 21:50:50 debian-mango systemd[1]: Failed to start LSB: Start or stop the Mango Automation.● mango.service - LSB: Start or stop the Mango Automation
Loaded: loaded (/etc/init.d/mango; generated)
Active: failed (Result: exit-code) since Mon 2019-08-05 21:50:50 AEST; 6min ago
Docs: man:systemd-sysv-generator(8)
Process: 764 ExecStart=/etc/init.d/mango start (code=exited, status=127)Aug 05 21:50:50 debian-mango systemd[1]: Starting LSB: Start or stop the Mango Automation...
Aug 05 21:50:50 debian-mango systemd[1]: mango.service: Control process exited, code=exited, status=127/n/a
Aug 05 21:50:50 debian-mango systemd[1]: mango.service: Failed with result 'exit-code'.
Aug 05 21:50:50 debian-mango systemd[1]: Failed to start LSB: Start or stop the Mango Automation.
screenshot:
below is my mango service file content:
(i played with the path for the commands but ended up with the same message)*#!/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="/vwang/mango/bin/ma.sh start" stop="/vwang/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*
Please let me know if the service message is correct. If it is not, what do I need to change to make it work.
Thanks in advance.
-
Hi cwangv,
Are you able to launch Mango from the command line?
sudo /vwang/mango/bin/ma.sh start
? -
@phildunlap
No, Phil.
But i can do
sudo ./mango/bin/ma.sh start.I did try using the 'mango/' without '/vwang' in front of it in the mango service file. but same message.
-
It sounds like maybe the path to Mango is wrong. Maybe the Mango directory is
/home/vwang/mango/
? Can you share the output of runningpwd
from wherever runningsudo ./mango/bin/ma.sh start
worked? -
Hi, Phil
Here is the output:vwang@debian-mango:~$ sudo ./mango/bin/ma.sh start
[sudo] password for vwang:
MA_HOME is /home/vwang/mango
vwang@debian-mango:~$ ma-start: MA started with Process ID: 7580It started successfully.
I actually went into the mango service file and added '/home/vwang' into the path. but same message.
Should at least the service status indication part work even with wrong path for the .sh file?thanks.
-
@phildunlap
Hi, Phil
Success!
In my last reply, I said i added 'home/vwang' in the path of the .sh files but it still didnt work.
I did a restart after that, and it is working now.
Here is the output just in case anyone wonders what the 'Ok' message looks like:
message in text form:
mango.service - LSB: Start or stop the Mango Automation
Loaded: loaded (/etc/init.d/mango; generated)
Active: active (running) since Mon 2019-08-05 23:47:15 AEST; 1min 28s ago
Docs: man:systemd-sysv-generator(8)
Process: 797 ExecStart=/etc/init.d/mango start (code=exited, status=0/SUCCESS)
Tasks: 40 (limit: 2166)
Memory: 405.7M
CGroup: /system.slice/mango.service
├─ 825 /bin/bash /home/vwang/mango/bin/ma-start.sh
├─ 866 java -server -cp /home/vwang/mango/overrides/classes:/home/vwang/mango/classes:/home/vwang/mango/overrides/properties:/home/vw
└─1984 sleep 3Aug 05 23:47:15 debian-mango systemd[1]: Starting LSB: Start or stop the Mango Automation...
Aug 05 23:47:15 debian-mango systemd[1]: Started LSB: Start or stop the Mango Automation.Thanks again for your prompt responses!
-
Glad you got it figured out!