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

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User