#!/bin/sh export PATH=/opt/play2:$PATH cd ~/server rundir=myproject repo=git@server:myproject.git temp=$rundir.buid.temp rm -rf $temp git clone $repo $temp cd $temp play -Dsbt.log.noformat=true clean compile stage chmod +x target/start cd .. if [ -d $rundir ] then cd $rundir if [ -f RUNNING_PID ] then pid=$(cat RUNNING_PID) if [ -e /proc/$pid ] then echo "Stopping previous instance with pid = $pid" play stop while [ -e /proc/$pid ]; do sleep 0.1; done else echo "Previous instance with pid = $pid seems to have died" fi else echo "No previous instance running" fi if [ -d logs ] then echo "Preserving logs" cp -r logs ../$temp fi cd .. fi rm -rf $rundir mv $temp $rundir cd $rundir ./target/start -Dsbt.log.noformat=true