A Linux-based file synchronization system implemented in C.
Uses multi-process architecture, pipes, inotify, and low-level file operations to keep directories in sync.
Developed as part of a university systems programming course, demonstrating strong skills in system-level programming, concurrency, and IPC.
- Multi-process architecture (
fork
,exec
) - Inter-process communication with pipes & signals
- Real-time directory monitoring using inotify
- Initial + incremental synchronization across directories
- Console interface with commands (
add
,shutdown
) - Logging system for manager and console
- Detailed execution & error reports
- C programming (Linux, system-level)
- Concurrency & Process Management
- Event-driven programming (
inotify
,poll
) - Data structures (linked list for sync state tracking)
- Low-level file I/O (
open
,read
,write
,unlink
) - Build automation with Makefile
hw/
├── fss_manager/ # Core manager process
│ ├── config_file # User-defined configuration (required)
│ ├── manager_log # Manager log file
│ └── ...
├── fss_console/ # Command-line console interface
│ └── console_log # Console log file
├── worker/ # Worker process handling sync operations
├── Makefile # Build automation
└── ...
make all
# or
make
Open two terminals:
Terminal 1 (Manager):
make run_fss_manager
Terminal 2 (Console):
make run_fss_console
config_file
must be inside thefss_manager
directory.- All
source_dir
andtarget_dir
paths should be relative tofss_manager
.- Example:
../source_dir ../target_dir
if outside, or justsource_dir
if inside.
- Example:
- To change arguments, edit the Makefile.
add <source_dir> -> <target_dir>
shutdown
- Reads configuration and spawns workers for synchronization.
- Tracks sync state with a linked list (
sync_info_mem_store
) keyed by:- Watch descriptor (inotify)
- Folder name
- Worker PID
- Handles pipes, signals, and logging.
- Runs two phases: initial sync, then incremental monitoring via inotify.
- Accepts user commands and communicates via named pipes.
- Supports
add
andshutdown
. - Maintains a log file for all activity.
- Handles file copy, delete, and modify using low-level system calls.
- Produces execution reports and error logs.
- Supports full directory sync and single-file operations.
- Console log output incomplete.
- No
.sh
wrapper provided. - Some commands parsed but not fully executed.
add
may behave differently depending on the environment.- Logging not fully consistent across components.
- Add more console commands (
remove
,modify
). - Improve error handling and logging.
- Provide shell scripts for easier execution.
- Enhance cross-system stability.
This project was developed for a university systems programming course, demonstrating proficiency in:
- Linux system-level programming
- Process & resource management
- Inter-process communication (IPC)
- Real-time file synchronization