mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-18 14:03:58 +00:00
- Update run_daily.sh to use compose.yaml env var overrides if present on scheduled jobs, not just first run. Defaults back to config.json values if no override specified. - update sample compose.yaml with volume mapping to keep config.json, accounts.json, and sessions folder persistent on local machine (e.g., to keep data persistent through updates).
36 lines
909 B
Bash
36 lines
909 B
Bash
#!/bin/bash
|
|
|
|
# Set up environment variables
|
|
export PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
|
|
|
|
# Ensure TZ is set
|
|
export TZ=${TZ}
|
|
|
|
# Change directory to the application directory
|
|
cd /usr/src/microsoft-rewards-script
|
|
|
|
# Define the minimum and maximum wait times in seconds
|
|
MINWAIT=$((5*60)) # 5 minutes
|
|
MAXWAIT=$((50*60)) # 50 minutes
|
|
|
|
# Calculate a random sleep time within the specified range
|
|
SLEEPTIME=$((MINWAIT + RANDOM % (MAXWAIT - MINWAIT)))
|
|
|
|
# Convert the sleep time to minutes for logging
|
|
SLEEP_MINUTES=$((SLEEPTIME / 60))
|
|
|
|
# Log the sleep duration
|
|
echo "Sleeping for $SLEEP_MINUTES minutes ($SLEEPTIME seconds)..."
|
|
|
|
# Sleep for the calculated time
|
|
sleep $SLEEPTIME
|
|
|
|
# Log the start of the script
|
|
echo "Starting script..."
|
|
|
|
# Update config with environment variables before running the script
|
|
node src/updateConfig.js
|
|
|
|
# Execute the Node.js script directly
|
|
npm run start
|