2023-05-09 18:03:46 +00:00
|
|
|
#!/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
|
|
|
|
|
2024-04-03 10:17:13 +00:00
|
|
|
WEB_URL='http://127.0.0.1:3000'
|
2023-05-09 18:03:46 +00:00
|
|
|
|
|
|
|
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."
|