-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathentrypoint.sh
More file actions
39 lines (31 loc) · 1.06 KB
/
entrypoint.sh
File metadata and controls
39 lines (31 loc) · 1.06 KB
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
36
37
38
39
#!/bin/sh
# Configure timezone if TZ is set
if [ -n "$TZ" ]; then
echo "Setting timezone to: $TZ"
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
echo $TZ > /etc/timezone
fi
# Check if the first argument is "check"
if [ "$1" = "check" ]; then
# Execute the Python script directly for single price check
exec python CheckRoyalCaribbeanPrice.py
fi
# If other arguments are provided, execute them
if [ $# -gt 0 ]; then
exec "$@"
fi
# Otherwise, set up cron for scheduled execution (default behavior)
# Set default cron schedule if not provided
if [ -z "$CRON_SCHEDULE" ]; then
CRON_SCHEDULE="0 7,19 * * *"
fi
# Export TZ for cron environment
echo "TZ=$TZ" > /etc/environment
# Create crontab with the specified schedule and timezone
echo "TZ=$TZ" > /etc/crontabs/root
echo "$CRON_SCHEDULE cd /app && python CheckRoyalCaribbeanPrice.py >> /proc/1/fd/1 2>&1" >> /etc/crontabs/root
# Set permissions for crontab
chmod 0600 /etc/crontabs/root
# Start crond in foreground
echo "Starting crond with schedule: $CRON_SCHEDULE (Timezone: $TZ)"
exec crond -f -d 8