overleaf/server-ce/cron/deactivate-projects.sh
Miguel Serrano c22e6a5926 Merge pull request #17694 from overleaf/bg-ipv6-fix-editing
Force services to use ipv4 in server-ce container

GitOrigin-RevId: 9cf2734f8506bba15ef3ac11060508d2604d09ad
2024-04-04 08:04:06 +00:00

28 lines
868 B
Bash
Executable file

#!/usr/bin/env bash
set -eux
echo "-------------------------"
echo "Deactivating old projects"
echo "-------------------------"
date
ENABLE_CRON_RESOURCE_DELETION=$(cat /etc/container_environment/ENABLE_CRON_RESOURCE_DELETION)
if [[ "${ENABLE_CRON_RESOURCE_DELETION:-null}" != "true" ]]; then
echo "Skipping old project deactivation due to ENABLE_CRON_RESOURCE_DELETION not set to true"
exit 0
fi
WEB_URL='http://127.0.0.1:3000'
USER=$(cat /etc/container_environment/WEB_API_USER)
PASS=$(cat /etc/container_environment/WEB_API_PASSWORD)
curl -v -X POST \
-u "${USER}:${PASS}" \
-H "Content-Type: application/json" \
-d '{"numberOfProjectsToArchive":"720","ageOfProjects":"7"}' \
"${WEB_URL}/internal/deactivateOldProjects"
echo "Done."