Linux daemon which synchronize two directories (source and destination)
Support recursive mode, so all files and subdirectories are synchronized too. All actions made by daemon are logged and accessible in /var/log/syslog
Usage: ./daemon sourcePath destinationPath [-d|--debug] [-R|--recursive] [-s=<sleep_time>|--sleep_time=<sleep_time>] [-B=<size_mb>|--big-file-size=<size_mb>]
Arguments:
sourcePath The path to the source directory.
destinationPath The path to the destination directory.
Options:
-d, --debug Enable debug mode.
-R, --recursive Synchronize directories recursively.
-s, --sleep_time The time in seconds to sleep between iterations. Default value is 10.
-B:5, --big-file-size:5 Fize size when daemon will use mapping file
Example usage:
./Demon /home/user/source /home/user/backup -R -s=5ps aux | grep Demon | grep -v grep | grep -v /bin/bash | awk '{print $2}' | while read pid; do kill -s SIGUSR1 $pid; donecommand to send signal to daemon
head -c 5MB /dev/zero > ostechnix.txtcommand to create 5MB file
sudo service rsyslog startin WSL we must enable rsyslog service manually to see logs in /var/log/syslog
tail -5 /var/log/syslogdisplay last 5 system logs
- Clone the repo
git clone https://github.com/Kaspek2480/FileSyncDemon cd FileSyncDemon - Build the application
mkdir build cmake -DCMAKE_BUILD_TYPE=Release -S . -B build cmake --build build - Add executable permissions
chmod +x Daemon
