diff --git a/examples/rand/run_server.sh b/examples/rand/run_server.sh index 2789064653f..26fc67aaed5 100755 --- a/examples/rand/run_server.sh +++ b/examples/rand/run_server.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -echo " run RealtimeStandaloneMain service in background" +echo "This will run RealtimeStandaloneMain service in background" set +u shopt -s xpg_echo shopt -s expand_aliases @@ -7,18 +7,18 @@ trap "exit 1" 1 2 3 15 # props are set in src/main/resources/runtime.properties -echo "cleaning up previous run, if any" -/bin/rm -fr /tmp/rand_realtime +[ -d /tmp/rand_realtime ] && echo "cleaning up from previous run.." && /bin/rm -fr /tmp/rand_realtime -# check rand_realtime.spec exists +# check spec file exists [ ! -e rand_realtime.spec ] && echo "expecting file rand_realtime.spec (as specified by property druid.realtime.specFile) to be in current directory" && exit 3 # start RealtimeNode process # -java -Xmx400m -Duser.timezone=UTC -Dfile.encoding=UTF-8 -classpath target/druid-examples-rand-*-selfcontained.jar druid.examples.RealtimeStandaloneMain >RealtimeNode.out 2>&1 & +echo "Log output of service can be found in ./RealtimeNode.out" +java -Xmx600m -Duser.timezone=UTC -Dfile.encoding=UTF-8 -classpath target/druid-examples-rand-*-selfcontained.jar druid.examples.RealtimeStandaloneMain >RealtimeNode.out 2>&1 & PID=$! -trap "kill $PID" 1 2 3 15 +trap "kill $PID ; exit 1" 1 2 3 15 sleep 4 grep druid.examples.RandomFirehoseFactory RealtimeNode.out | awk '{ print $7,$8,$9,$10,$11,$12,$13,$14,$15 }' wait $PID diff --git a/examples/twitter/run_server.sh b/examples/twitter/run_server.sh index 603c9d9e9dc..cea22bcd703 100755 --- a/examples/twitter/run_server.sh +++ b/examples/twitter/run_server.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash -echo " This will run RealtimeStandaloneMain service in background" +echo "This will run RealtimeStandaloneMain service in background" +set +u +shopt -s xpg_echo +shopt -s expand_aliases PF=./twitter4j.properties -# check twitter_realtime.spec exists -[ ! -e twitter_realtime.spec ] && echo "expecting file twitter_realtime.spec (as specified by property druid.realtime.specFile) to be in current directory" && exit 3 - # if twitter4j.properties already exists, then user is okay with having twitter pw in file. # Otherwise a twitter4j.properties file in curr. dir. is made temporarily for twitter login. if [ -e "$PF" ]; then @@ -29,14 +29,16 @@ trap "${PF_CLEANUP} ; exit 1" 1 2 3 15 [ -d /tmp/twitter_realtime ] && echo "cleaning up from previous run.." && /bin/rm -fr /tmp/twitter_realtime -echo "Log output of service can be found in ./RealtimeNode.out" +# check spec file exists +[ ! -e twitter_realtime.spec ] && echo "expecting file twitter_realtime.spec (as specified by property druid.realtime.specFile) to be in current directory" && exit 3 OPT_PROPS="" #OPT_PROPS="-Dtwitter4j.debug=true -Dtwitter4j.http.prettyDebug=true" # start RealtimeNode process # -java -Duser.timezone=UTC -Dfile.encoding=UTF-8 -Xmx600m -classpath target/druid-examples-twitter-*-selfcontained.jar $OPT_PROPS -Dtwitter4j.http.useSSL=true -Ddruid.realtime.specFile=twitter_realtime.spec druid.examples.RealtimeStandaloneMain >RealtimeNode.out 2>&1 & +echo "Log output of service can be found in ./RealtimeNode.out" +java -Xmx600m -Duser.timezone=UTC -Dfile.encoding=UTF-8 -classpath target/druid-examples-twitter-*-selfcontained.jar $OPT_PROPS -Dtwitter4j.http.useSSL=true druid.examples.RealtimeStandaloneMain >RealtimeNode.out 2>&1 & PID=$! trap "${PF_CLEANUP} ; kill ${PID} ; exit 1" 1 2 3 15