Installing Copidar on Debian
Copidar can be integrated into a Debian system via three primary methods: using the APT package manager (recommended for stability), compiling from source (for latest versions), or via Docker (for isolation).
APT Package Manager (Recommended):
Update the package list and install Copidar directly:
sudo apt update && sudo apt install copidar
Verify installation with copidar --version. This method handles dependencies automatically and is ideal for production environments.
Compiling from Source:
For the latest features or if APT lacks the package, compile from source:
sudo apt install build-essential git cmake.git clone https://github.com/Copidar/Copidar.git && cd Copidar.mkdir build && cd build && cmake .. && make && sudo make install.copidar --version. This method requires manual dependency management but offers flexibility.Docker Integration:
For containerized environments, use the official Copidar Docker image:
sudo apt install docker.io.docker pull copidar/copidar.docker run -it --rm copidar/copidar. This avoids system-level conflicts and simplifies deployment.Basic Usage of Copidar
Once installed, Copidar can sync directories, monitor changes, and trigger actions. Key commands include:
-r for recursion and -d to delete extra files in the destination:copidar -r /source/directory /destination/directory
copidar -r -d /source/directory /destination/directory
-v for detailed output:copidar -r -v /source /destination
*.tmp) or directories (e.g., cache/):copidar -r --exclude '*.tmp' --exclude 'cache/' /source /destination
*/5 * * * * copidar -r -v /source /destination >> /var/log/copidar.log 2>&1
Logs help troubleshoot issues and verify successful syncs.Configuration Management
Copidar supports configuration via YAML or JSON files for advanced settings (e.g., watched directories, event handlers).
YAML Configuration: Create ~/.config/copidar/config.yaml with:
watch_directories:
- /path/to/watch
event_handlers:
- command: /path/to/script.sh
events: [create, modify, delete]
Start with copidar -c ~/.config/copidar/config.yaml.
JSON Configuration: Some versions use /etc/copidar/config.json (edit with sudo nano):
{
"watch_directories": ["/path/to/watch"],
"event_handlers": [{"command": "/path/to/script.sh", "events": ["create", "modify"]}]}
}
Restart the service after changes (if using systemd).
Automation & Integration
Integrate Copidar with system services or scripts for automation:
Systemd Service: Create /etc/systemd/system/copidar.service for automatic startup:
[Unit]
Description=Copidar File Monitor
After=network.target
[Service]
ExecStart=/usr/bin/copidar --watch /path/to/watch
Restart=always
[Install]
WantedBy=multi-user.target
Enable and start the service:
sudo systemctl daemon-reload && sudo systemctl enable copidar && sudo systemctl start copidar
Check status with sudo systemctl status copidar.
Cron Jobs: Schedule periodic syncs (e.g., hourly) by adding to crontab (crontab -e):
0 * * * * /usr/bin/copidar -r -v /source /destination >> /var/log/copidar.log 2>&1
Logs are saved to /var/log/copidar.log for review.
Troubleshooting Tips
sudo apt install -f to fix broken dependencies during compilation or installation.config.py or startup command) if another service uses the same port.sudo for commands requiring root access (e.g., installing system-wide or accessing protected directories).