Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge "Clean up existing legacy echo server"

  • Loading branch information...
commit e7e6d5b5f27bbcd54fb4c5c91f9401962aaa3064 2 parents 3f14f10 + 1b4764f
@bluesalt bluesalt authored Gerrit Code Review committed
View
16 dev_setup/cookbooks/echo/recipes/default.rb
@@ -16,12 +16,26 @@
bash "Install Echo Server" do
code <<-EOH
+ if [ -L "/etc/init.d/echoserver" ]; then
+ service echoserver stop
+ rm /etc/init.d/echoserver
+ fi
+
+ if [ -d "/tmp/echoserver/" ]; then
+ rm -rf /tmp/echoserver/
+ fi
+
+ if [ -d #{File.join(node[:echo_server][:path])} ]; then
+ rm -rf #{File.join(node[:echo_server][:path])}
+ fi
+
unzip #{echoserver_tarball_path} -d /tmp
cp -r /tmp/echoserver #{File.join(node[:deployment][:home], 'deploy')}
ln -s -f -t /etc/init.d/ #{File.join(node[:echo_server][:path], 'echoserver')}
EOH
not_if do
- ::File.exists?(File.join(node[:echo_server][:path], 'echoserver'))
+ File.symlink?("/etc/init.d/echoserver") and \
+ (File.join(node[:echo_server][:path], 'echoserver') == File.readlink("/etc/init.d/echoserver"))
end
end
View
4 dev_setup/cookbooks/echo/templates/default/echoserver.erb
@@ -85,6 +85,10 @@ kill_and_wait() {
start_echoserver() {
echo "starting echo server"
+ lsof -i:<%= node[:echo_server][:port] %> > /dev/null \
+ && echo "Port <%= node[:echo_server][:port] %> is not available" \
+ && exit 1
+
java \
-jar $ECHOSEVER_ROOT/lib/EchoServer-0.1.0.jar \
-port <%= node[:echo_server][:port] %> \
Please sign in to comment.
Something went wrong with that request. Please try again.