From e79083ce6568b77ccf6336b6d0f4b312daf70249 Mon Sep 17 00:00:00 2001 From: flu0r1ne Date: Tue, 12 Sep 2023 06:27:27 -0500 Subject: Add systemd and correct cron --- README.md | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3d22a5b..cb75387 100644 --- a/README.md +++ b/README.md @@ -28,26 +28,54 @@ on my radar, it's taken a backseat since this simpler version fulfills my curren ## How to Use -To schedule the script to run at 3:00 a.m. on an Ubuntu host, follow these steps: +### Cron + +To schedule the script to run every 30 minutes on an Ubuntu host, follow these steps: 1. Make the script executable: - ```bash + ``` chmod +x rbuild.py mv rbuild.py /usr/local/bin/ ``` 2. Open the crontab editor: - ```bash + ``` crontab -e ``` 3. Add the following line to run the script every 30 minutes: - ```cron - */30 * * * * /usr/local/bin/rbuild.py ``` + */30 * * * * /usr/local/bin/rbuild.py /path/to/your/compose.yml + ``` + +### systemd + +Rebuild the site at 3 AM. + +``` +[Unit] +Description=Rebuild site + +[Service] +ExecStart=/usr/local/bin/rbuild.py /path/to/your/compose.yml --force-rebuild +``` + +``` +[Unit] +Description=Rebuild site at 3AM + +[Timer] +OnBootSec=3min +# 3AM +OnCalendar=*-*-* 3:00:00 +Persistent=true + +[Install] +WantedBy=timers.target +``` ### Environment Variables -- cgit v1.2.3