java - bash script issue launching programs -
i have bash script executed when aws ec2 ubuntu instance boots, via aws server launch configuration (which bash script) using following command
sudo -u ubuntu /vagrant/test/startall.sh
the issue i'm seeing java programs don't run if they're last entry in bash script, run fine if not last entry. i'm bit stumped why it's happening.
here's bash script...
startall.sh
#!/bin/bash # set -x brokersrvdir="/vagrant/test/ppp" meetingsrvdir="/vagrant/test/clone" notifysrvdir="/vagrant/test/notification/production/notificationsrv" workerdir="/vagrant/test/ppp/production/ppworker2" #( cd $workerdir && { make runworker >>log/out.txt 2>&1 & } ) ( cd $brokersrvdir && { ./ppp_broker >>log/out.txt 2>&1 & } ) ( cd $notifysrvdir && { make runnotify >>log/out.txt 2>&1 & } ) ( cd $meetingsrvdir && { ./meetingsrv > /dev/null 2>>log/out.txt & } ) ( cd $workerdir && { make runworker >>log/out.txt 2>&1 & } ) #( sleep 10s && cd $brokersrvdir && { ./ppp_broker >>log/out.txt 2>&1 & } )
ppp_broker
, meetingsrv
c executables
make runworker
, make runnotify
make calls run java programs
here's makefile worker java program
makefile
dlibs=-lzmq -lczmq ldflags= cflags=-ddebug cpflag=-cp /usr/local/share/java/*:. cpflagdb=-cp /usr/local/share/java/*:. -xx:+heapdumponoutofmemoryerror -xx:errorfile=log/hs_err_pid_%p.log cpflagp=-cp /usr/local/share/java/*:. - jflags = -g javac=javac sources = $(wildcard *.java) classes = $(sources:.java=.class) all: $(classes) clean : rm -f *.class %.class : %.java #export ld_library_path=$(ld_library_path):/usr/local/lib/* #export classpath=$(classpath):/usr/local/share/java/*:. $(javac) $(jflags) $(cpflag) $< .oneshell: runworker : export ld_library_path=$(ld_library_path):/usr/local/lib/* export classpath=$(classpath):/usr/local/share/java/*:. java $(cpflagdb) -djava.library.path=/usr/local/lib/ ppworker2
update: set x output
ubuntu@ip-xxxx:/vagrant/test$ /vagrant/test/startall.sh + brokersrvdir=/vagrant/test/ppp + meetingsrvdir=/vagrant/test/clone + notifysrvdir=/vagrant/test/notification/production/notificationsrv + workerdir=/vagrant/test/ppp/production/ppworker2 + cd /vagrant/test/ppp + cd /vagrant/test/notification/production/notificationsrv + ./ppp_broker + cd /vagrant/test/clone + make runnotify + cd /vagrant/test/ppp/production/ppworker2 + ./meetingsrv ubuntu@ip-xxxx:/vagrant/test$ + make runworker
output ps
after running above:
ubuntu@ip-xxxx:/vagrant/test$ ps -ef | grep make ubuntu 2104 1 0 18:06 pts/0 00:00:00 make runnotify ubuntu 2144 1479 0 18:06 pts/0 00:00:00 grep --color=auto make
so bash script executes make call according set x, it's not running.
as per comment, spun new ec2 instance , works. i'll put down ec2 weirdness now, if happens again i'll dig deeper. thanks!
Comments
Post a Comment