From a932f484255151c0905a969915b8772571affdf5 Mon Sep 17 00:00:00 2001 From: LightZirconite Date: Mon, 3 Nov 2025 19:28:43 +0100 Subject: [PATCH] docs: update scheduling instructions in Docker and setup documentation --- docs/docker.md | 96 ----------------------------------------- docs/schedule.md | Bin 6631 -> 3181 bytes setup/update/setup.mjs | 4 +- 3 files changed, 2 insertions(+), 98 deletions(-) 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 b56836dc768e8675ee204641039d067b04c7aa0c..771bc8bde2d8fa85814957431e2120e9527b1699 100644 GIT binary patch delta 21 dcmaEE{8nPaVkWlyJcW{s)XmG74s$Yc0RUts2kQU; delta 1672 zcmaDW@!WXBVkYKCZId>yWID{rtgK)^k@1#@mR3k&akfHmaz<)OX-;a9mX?D3#E&9^ z@AvQ3(o#swOHs&6%uQ9uESbE3UCdsO%ScbbIU_&6I8`B0p`<7?Jw3HZK_ewGGpABV zp*%G;8${<9DI}IC6qh6xm6R4}>TwzCDFmnHq$Zb4&S%uL*3t?n%1|Ge0jeN7G76Yw|v3?a6ga;yNW6sd);iDVZe-B^jv-B_L1QD`;uCr{<*= zCFW>pDU>88SwYNloqT{v&s8BUzeph|F*!TED8Do>MIp5!HMtaIupUH}b4F@%wt|*c zP-&h*d1gt5LPlnKMrv`1LP1exS!PaZdTOzj)?^N5mC5Pca=b~E3W)^;sd*`xdFcw1 zO_;R;6iV{JP6+_{H5lYqh2;F)+{C;TJuWUgg@B^ewA3PnM1`cplH?49w9K4Tdj;pB z)Wnih1+LOO-J;a;#G;g9y`;nvi1m|qG8?FaV~DFDSD~mh4-(=!AWQNT3i31a5MG}w z$ztdlmRgjVR;iGvkeirSnwSI8QktBcnwnBk zc}I6^joW3nqpq!`HKkfc&vl2}q&42`TE97@XIuqaARPR%O;1%9zYS!SX_ zR(@$wUSdviNsfYUslwzyHsQ%4oF<9|sYPk|MY+Wai3-J;dFfD}DkN1Zq@<=Lmgba9 zj^dQB&&V$>Q2@n;j)He-Qfg6NYDsFbf^$)Ro>zX7jzVflvYw_Mm##uczCw0tYJoyA zB%6amH8Za`GX>&@WKe8o=A{WhlK|w)T!39(TfO5TorImpJmx4l2s9(IlUwm+gV^D~df>KFQ zX{wR}94IUJL-VXcW^Qh3N+u|kgOYGLDA$4_9PTECr2PDnVlD-R1TF=Ikc?D?)Vz|S zN=Wj~%quRLY|kZ7577b6ObUs~$@xX#Y*&)60CHx0u(OA&OQ?^l4mbiz5;Jp(74*vz zi}Z8y)Ad22r XEi?HSw<+`c{d*@H@`!_JFCJw8dh9Q$ 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).'); } }