···8383./compose-sync -config /path/to/config.yml
8484```
85858686+### Systemd Service and Timer (Automatic Execution)
8787+8888+To run compose-sync automatically using systemd:
8989+9090+1. **Install the binary** (if not already installed):
9191+ ```bash
9292+ sudo cp compose-sync /usr/local/bin/
9393+ ```
9494+9595+2. **Edit the service file** (`compose-sync.service`):
9696+ - Replace `youruser` with the actual user that should run compose-sync (make sure this user has the correct permissions)
9797+ - Adjust paths if needed (binary location, config file, etc.)
9898+9999+3. **Copy the service and timer files**:
100100+ ```bash
101101+ sudo cp compose-sync.service compose-sync.timer /etc/systemd/system/
102102+ ```
103103+104104+4. **Reload systemd and enable the timer**:
105105+ ```bash
106106+ sudo systemctl daemon-reload
107107+ sudo systemctl enable compose-sync.timer
108108+ sudo systemctl start compose-sync.timer
109109+ ```
110110+111111+5. **Check status**:
112112+ ```bash
113113+ sudo systemctl status compose-sync.timer
114114+ sudo systemctl status compose-sync.service
115115+ ```
116116+117117+6. **View logs**:
118118+ ```bash
119119+ sudo journalctl -u compose-sync.service -f
120120+ ```
121121+122122+The timer will run compose-sync every 5 minutes. To change the interval, edit `compose-sync.timer` and modify the `OnUnitActiveSec` value.
123123+86124## How It Works
87125881261. **Host Detection**: The tool uses the system hostname to identify the current host
+17
systemd/compose-sync.service
···11+[Unit]
22+Description=compose-sync - Sync and deploy Docker Compose stacks from git
33+After=network-online.target docker.service
44+Wants=network-online.target
55+66+[Service]
77+Type=oneshot
88+# Replace 'youruser' with the actual user that should run compose-sync
99+User=youruser
1010+# Path to compose-sync binary (adjust if installed elsewhere)
1111+# If config.yml is not in the default location, add: -config /path/to/config.yml
1212+ExecStart=/usr/local/bin/compose-sync
1313+Environment="HOME=/home/youruser"
1414+WorkingDirectory=/home/youruser
1515+StandardOutput=journal
1616+StandardError=journal
1717+