Howto autostart a java -jar file after MySQL (mariadb) has started in Xubuntu 16.04? - Ask Ubuntu


i used run script in startup , session in xubuntu 14.04 autostart java app:

xfce4-terminal -e "bash -c \"cd /home/restaurant/documents/dist/ && java -jar posv2.jar; exec bash\"" 

but running same script in 16.04 causes mysql exceptions; assume these exceptions thrown because mysql wasn't loaded yet when script ran. therefore question how can make sure script called once mysql has been loaded successfully?

create script start every boot checking every 2 seconds if mysql process running, if execute command.

lets create script called filename.sh content:

#!/bin/bash app="gedit" while true;         pid=`pidof $app`     if [ ! -z $pid ];         # found process running on system.                     java -jar "/home/restaurant/documents/dist/posv2.jar"         exit 0     fi     sleep 2 done 

make executable:

chmod +x filename.sh 

just change app="gedit" process name instead of gedit.
make running @ start up: how run script @ start up?.


Comments

Popular posts from this blog

crash - Windows Rundll32 (child process of DllHost) is crashing. How can I even identify it? - Super User

debian - Kali Linux - Debootstrap error Failed to determine codename for the release - Super User

networking - Slave steals IP meant for bonded interface - Ask Ubuntu