-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
13 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
#!/bin/bash | ||
|
||
# Ensure environment variables are available | ||
# Check required environment variables | ||
if [ -z "$CRON_SCHEDULE" ] || [ -z "$PORT" ]; then | ||
echo "Required environment variables are missing." | ||
exit 1 | ||
fi | ||
|
||
# Create a cron job file dynamically | ||
echo "$CRON_SCHEDULE cd /app && curl -X POST http://127.0.0.1:$PORT/api/releases/ -H 'x-api-key: your_api_key_here' >> /var/log/cron.log 2>&1" > /etc/cron.d/toloka-job | ||
chmod 0644 /etc/cron.d/toloka-job | ||
crontab -u appuser /etc/cron.d/toloka-job | ||
(crontab -l 2>/dev/null; echo "$CRON_SCHEDULE curl -X POST http://127.0.0.1:$PORT/api/releases/ -H 'x-api-key: your_api_key_here'") | crontab -u appuser - | ||
|
||
# Start cron | ||
crond | ||
# Start cron in the foreground to handle logs better | ||
crond -f -L /dev/stdout & | ||
|
||
# Start the web server | ||
exec python -m app |