#!/bin/bash

export DIR=$(dirname $0)

function prefix_date(){
	while read line
	do
		echo [$(date)] $line
	done
}

function run_update(){
	cd $DIR
	echo run autoupdate in $(pwd)
	git pull
	cd backend
	python3 manage.py migrate
	python3 manage.py collectstatic --noinput
}

run_update | prefix_date >> $DIR/update.log
