diff --git a/docs/docker.md b/docs/docker.md index f98bc5d..a8577cb 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -190,102 +190,6 @@ tail -100 /var/log/cron.log --- -**[← Back to Hub](index.md)** | **[Getting Started](getting-started.md)**# 🐳 Docker Guide - -**Run the script in a container** - ---- - -## ⚡ Quick Start - -### 1. Create Required Files - -Ensure you have: -- `src/accounts.jsonc` with your credentials -- `src/config.jsonc` (uses defaults if missing) - -### 2. Start Container - -## 🎛️ Scheduling Options - -### Use a host scheduler (recommended) - -- Trigger `docker compose up --build` on your preferred schedule (cron, systemd timers, Task Scheduler, Kubernetes CronJob, etc.). -- Ensure volumes remain consistent so each run reuses accounts, config, and sessions. -- See [External Scheduling](schedule.md) for concrete host examples. - -### Enable in-container cron (optional) - -1. Set environment variables in `docker-compose.yml` or `docker run`: - build: . - environment: - TZ: "Europe/Paris" - command: ["npm", "run", "start:schedule"] -``` - -Configure schedule in `src/config.jsonc`: -```jsonc -{ - "schedule": { - "enabled": true, - "useAmPm": false, - "time24": "09:00", - "timeZone": "Europe/Paris" - } -} -``` - -### Option 2: Native Cron (For Traditional Cron Users) - -**Pros:** -- ✅ Familiar cron syntax -- ✅ Multiple daily runs with standard crontab -- ✅ Native Linux scheduling - -**Setup:** - -1. **Enable cron in `docker-compose.yml`:** -```yaml -services: - rewards: - build: . - environment: - TZ: "Europe/Paris" - USE_CRON: "true" - CRON_SCHEDULE: "0 9,16,21 * * *" # 9 AM, 4 PM, 9 PM daily - RUN_ON_START: "true" # Optional: run once on start -``` - -2. **Cron Schedule Examples:** - -| Schedule | Description | Cron Expression | -|----------|-------------|-----------------| -| Daily at 9 AM | Once per day | `0 9 * * *` | -| Twice daily | 9 AM and 9 PM | `0 9,21 * * *` | -| Three times | 9 AM, 4 PM, 9 PM | `0 9,16,21 * * *` | -| Every 6 hours | 4 times daily | `0 */6 * * *` | -| Weekdays only | Mon-Fri at 8 AM | `0 8 * * 1-5` | - -**Use [crontab.guru](https://crontab.guru) to validate your cron expressions.** - -3. **Rebuild and restart:** -```bash -docker compose down -docker compose build --no-cache -docker compose up -d -``` - -4. **Verify cron is running:** -```bash -# Check container logs -docker logs -f microsoft-rewards-bot - -# Should see: "==> Cron mode enabled" - -# View cron logs inside container -docker exec microsoft-rewards-bot tail -f /var/log/cron.log -``` - ### Option 3: Single Run (Manual) ```yaml diff --git a/docs/schedule.md b/docs/schedule.md index b56836d..771bc8b 100644 Binary files a/docs/schedule.md and b/docs/schedule.md differ diff --git a/setup/update/setup.mjs b/setup/update/setup.mjs index bee1eda..ae736d8 100644 --- a/setup/update/setup.mjs +++ b/setup/update/setup.mjs @@ -154,8 +154,8 @@ async function fullSetup() { if (['yes', 'y'].includes(start)) { await runCommand(process.platform === 'win32' ? 'npm.cmd' : 'npm', ['run', 'start']); } else { - log('\nFinished setup. To start later, run: npm start'); - log('For automated scheduling, run: npm run start:schedule'); + log('\nFinished setup. To start later, run: npm start'); + log('For automated scheduling, use your OS scheduler (see docs/schedule.md).'); } }