Skip to content

Instantly share code, notes, and snippets.

@francisdb
Created May 7, 2013 15:18
Show Gist options
  • Save francisdb/5533430 to your computer and use it in GitHub Desktop.
Save francisdb/5533430 to your computer and use it in GitHub Desktop.
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment