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=5
ps aux | grep Demon | grep -v grep | grep -v /bin/bash | awk '{print $2}' | while read pid; do kill -s SIGUSR1 $pid; done
command to send signal to daemon
head -c 5MB /dev/zero > ostechnix.txt
command to create 5MB file
sudo service rsyslog start
in WSL we must enable rsyslog service manually to see logs in /var/log/syslog
tail -5 /var/log/syslog
display 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