diaspora/script/server
Alec Leamas e7efd5fbf7 Compress source.tar
Compress source.tar, reducing overall distributed source size with
about 30%. Also, actually push this branch ;)
2010-10-19 08:26:42 +02:00

40 lines
904 B
Bash
Executable file

#!/bin/bash
#
# Start diaspora websocket and main services
#
# Is someone listening on the port already? (ipv4 only test ?)
PORT=3000
while getopts ":p:" OPTION
do
if [ $OPTION == 'p' ]
then
PORT=$OPTARG
fi
done
services=$( netstat -nl | grep ":$PORT[ \t]")
test -n "$services" && {
echo "Warning: something is already using port "$PORT
echo " $services"
exit
}
# Check if Mongo is running
if ! ps ax | grep -v grep | grep mongod >/dev/null
then
echo "Mongod not started"
else
mkdir -p -v log/thin/
#force AGPL
test -w public -a ! -e public/source.tar.gz &&
tar czf public/source.tar.gz --exclude='source.tar.gz' -X .gitignore *
test -e public/source.tar.gz || {
echo "Can't find, or even create, public/source.tar.gz. Giving up"
exit 2
}
bundle exec ruby ./script/websocket_server.rb&
bundle exec thin start $@
fi