#!/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 source venv/bin/activate pip3 install -r requirements.txt python3 manage.py migrate python3 manage.py collectstatic --noinput echo done } run_update | prefix_date >> $DIR/update.log