Actually the "missing link" was catching pid of java, not mango, so simple "kill pidof java
" instead "killall mango" inside stop part of script seems to work just fine.
Latest posts made by ime
-
RE: Start / stop mango from linux shell script
-
RE: Start / stop mango from linux shell script
"kill <procId>" seems to work fine. I`ll try in this direction and post here final working script.
Thanks.
-
RE: Start / stop mango from linux shell script
Ok i changed script a bit so that it works for automatic startup at boot. I added $ALL $sshd in required-start and "&" char at the end of calling ma-start.sh. Now i can get to login prompt from keyboard and also connect over ssh to the system. Also in etc/rc.local file i added these two llines for getting serial port to work correctly with mango (thanks to Cyberdog):
sudo ln -s /dev/ttyAMA0 /dev/ttyS0 sudo chown root:dialout /dev/ttyS0
now my /etc/init.d/mango script looks like this:
#! /bin/sh # /etc/init.d/mango ### BEGIN INIT INFO # Provides: mango # Required-Start: $ALL $sshd $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Description: script to start / stop mango ### END INIT INFO case "$1" in start) echo "Starting mango" /home/pi/mango/ma-start.sh & ;; stop) echo "Stopping mango" killall mango ;; *) echo "Usage: /etc/init.d/mango {start|stop}" exit 1 ;; esac exit 0
Still can
t figure out "stop" part. Killall isn
t solution. -
RE: Start / stop mango from linux shell script
@JoelHaggar said:
Attached is a linux service that works on Ubuntu. I put it in the ext/init/ dir You'll have to edit the path to the ma-start.sh file but then you can run sudo service mango start and sudo service mango stop from the terminal.
Let me know if this works for you?
Joel.
Thanks, this works on ubuntu. I already have similar conf file on ubuntu machine, but i
m trying this also on raspberry pi (sorry, did
t mention at the beginning) which has some issues with upstart configuration files, and i was hoping getting mango as a service through init.d kind of script. Do you have any idea about this?
Also starting on boot with this script as i wrote in first post is not good because mango should run after all other service - with this script i locked myself without login prompt and also ssh deamon didn`t started, so i had to correct files on SD card from another linux box. -
RE: Start / stop mango from linux shell script
@mlohbihler said:
What do you mean the kill signal doesn't close the database as it should? It does for me.
I mean then when i close mango with command "/etc/init.d/mango stop" from another terminal window i cannot run it again because it says the another instance of db is already running. It doesn`t terminate mango as does ctrc+c inside terminal from which mango is started, but rather forcefully shuts it down leaving database open.
-
Start / stop mango from linux shell script
Can someone help me with advice how to stop mango from /etc/init.d shell script.
I want to start mango automatically after machine boots and this works ok, but for shutdown i tried with sending killall signal which is not good as it doesnt close database as it should so mango can
t be started again.So the question is how should i modify stop case in next script so that mango finishes the same way when closed with ctrl+c from terminal window:
#! /bin/sh # /etc/init.d/mango case "$1" in start) echo "Starting mango" /home/user/mango/ma-start.sh ;; stop) echo "Stopping mango" killall mango ;; *) echo "Usage: /etc/init.d/mango {start|stop}" exit 1 ;; esac exit 0
-
RE: Start / stop mango from linux shell script
Can someone help me with advice how to stop mango from /etc/init.d shell script.
I want to start mango automatically after machine boots and this works ok, but for shutdown i tried with sending killall signal which is not good as it doesnt close database as it should so mango can
t be started again.So the question is how should i modify stop case in next script so that mango finishes the same way when closed with ctrl+c from terminal window:
#! /bin/sh # /etc/init.d/mango case "$1" in start) echo "Starting mango" /home/user/mango/ma-start.sh ;; stop) echo "Stopping mango" killall mango ;; *) echo "Usage: /etc/init.d/mango {start|stop}" exit 1 ;; esac exit 0
-
RE: Ubuntu 12.04 / java 1.7.0_09 / librxtx-java / mango automation Installation How-to
Maybe i should mention in first post that i used 32 bit ubuntu. I had no idea that it would matter regarding rxtx issues.
Do you have any clue what would be minimum hardware specifications for running mango smoothly?
-
RE: Ubuntu 12.04 / java 1.7.0_09 / librxtx-java / mango automation Installation How-to
copied from http://rxtx.qbang.org/wiki/index.php/Download#x64_Binaries
x64 Binaries
Should you wish to use RxTx on a x64 based computer, note that the downloads on this page will not work, for x64 compiled binaries go to: Cloudhopper RxTx page. Binaries have been tested successfully on Windows Server 2008 R2, although they are slightly outdated (december 2008), and known to crash when unplugging an USB serial adapter. Another option obtaining prebuilt binaries for x64 is one of the #Known RXTX forks below.
-
RE: Ubuntu 12.04 / java 1.7.0_09 / librxtx-java / mango automation Installation How-to
You
re welcome. Thank you for sharing this SCADA. No special reason for 1.7. I just wanted latest available software packages, and as for tomcat - it
s not needed for latest mango, right?
I also tried installing with openjdk but had some problems regarding librxtx so decided to drop it and install from oracle.
Cheers!