#!/bin/sh

. /etc/container_environment.sh
. /etc/overleaf/env.sh

cd /overleaf/services/project-history && /sbin/setuser www-data node scripts/flush_all.js >> /var/log/overleaf/project-history.log 2>&1

EXIT_CODE="$?"
if [ $EXIT_CODE -ne 0 ]
then
  echo "project-history/scripts/flush_all.js failed with exit code $EXIT_CODE"
  exit 1
fi

exit 0
