#!/bin/bash
# Change Current Directory
cd /root/pai2/minipai2/
# Load Old Mini Paiai Configuration
source minipai2.conf
# Old Version
oldversion=$version
# Fix Bug: http://stackoverflow.com/questions/11706215/how-to-fix-git-error-object-file-is-empty/12371337#12371337
find .git/objects/ -type f -empty | xargs rm &> /dev/null
git fetch -p
git fsck --full
# Fetch Remote Master Branch Refs
git pull origin master
# Load New Mini Paiai Configuration
source minipai2.conf
# If Version Upgrade & Delete Database True
if [ "$oldversion" != "$version" ] && [ "$deldb" = "true" ]; then
# Delete Database
rm minipai2.db
fi
# Remove *.pyc
rm -rf ./utils/*.pyc
# Start Server
if [ -d "/ramfs/" ]; then
nohup python main.py --port=8002 &>/ramfs/minipai2.log &
else
nohup python main.py --port=8002 &>/tmp/minipai2.log &
fi
# Change Current Directory
cd -
|