-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
35 lines (26 loc) · 971 Bytes
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
/usr/src/app/wait-for-it.sh db:5432 --timeout=30 --strict -- echo "Database is up"
python manage.py migrate --noinput
python manage.py shell << 'EOF'
from django_q.models import Schedule
if not Schedule.objects.filter(func='tripapp.tasks.fetch_locations_for_tripper').exists():
print("Creating scheduled task 'fetch_locations' ...")
Schedule.objects.create(
func='tripapp.tasks.fetch_locations_for_tripper',
schedule_type=Schedule.DAILY,
repeats=-1
)
else:
print("Scheduled task 'fetch_locations' already exists.")
if not Schedule.objects.filter(func='tripapp.tasks.assign_badges').exists():
print("Scheduled task 'assign_badges' does not exist yet. Creating...")
Schedule.objects.create(
func='tripapp.tasks.assign_badges',
schedule_type=Schedule.DAILY,
repeats=-1
)
else:
print("Scheduled task 'assign_badges' already exists.")
EOF
python manage.py qcluster &
exec "$@"