Simple automated file synchronization from RNO-G sites in Greenland to DESY using rsync, managed by systemd.
Serpentine provides two systemd services that continuously synchronize data and metadata from local storage to a remote DESY server. The services run as background processes with automatic restart capabilities and watchdog monitoring.
serpentine-copy — Copies raw data files from /data/outbox to DESY
- Transfer rate: 48 kB/s
- Rsync timeout: 1 hour per sync cycle
- Source directory:
/data/outbox - Removes synced files from source after transfer
- Managed by systemd (runs continuously)
serpentine-copy-meta — Copies metadata files from /data/ingress to DESY
- Transfer rate: 48 kB/s
- Sync interval: 10 seconds between cycles
- Source directory:
/data/ingress - Excludes logs, waveforms, headers, and other large data types
- Managed by systemd (runs continuously)
copy-data — Manual utility for copying specific files to DESY
- Transfer rate: 24 kB/s
- Source directory:
/data/rootified/ - One-time transfer (not a service)
- Usage:
./copy-data <filelist.txt>filelist.txtshould contain relative paths to files in/data/rootified/- Files are expected to follow the directory structure:
stationXX/runYYYYYY/file
- Root access or sudo privileges
- rsync installed
- systemd available
- SSH key authentication configured for DESY server
make install # Install service files to /etc/systemd/system
make enable # Enable services on boot
make start # Start services immediatelyAlternatively, install step-by-step:
sudo make install
sudo make enable
sudo systemctl start serpentine-copy serpentine-copy-metaEdit the bash scripts to customize rsync behavior:
serpentine-copy and serpentine-copy-meta — Modify these variables:
DESTHOST— Remote server hostnameDESTUSER— SSH user for remote connectionDESTDIR— Remote destination directoryRATE— Transfer rate limit (kB/s)PERMS— File/directory permissions after sync--exclude— File patterns to skip
The copy-data script transfers specific files on-demand (not as a background service):
- Create a text file listing the relative paths of files to copy:
station01/run001/data.root
station02/run002/data.root
station03/run003/data.root
- Run the script:
./copy-data filelist.txtFiles must be in /data/rootified/ and follow the directory structure stationXX/runYYYYYY/file.
make status # Check service status
make logs # Show recent logs
make restart # Restart services
make stop # Stop services
make start # Start services
make clean # Uninstall and disable services
make help # Show all available commandssystemctl status serpentine-copy
systemctl stop serpentine-copy
systemctl restart serpentine-copy
journalctl -u serpentine-copy -f # Follow logs in real-timeView logs using journalctl:
# Recent logs
journalctl -u serpentine-copy -n 50
# Real-time logs
journalctl -u serpentine-copy -f
# Combined logs for both services
journalctl -u serpentine-copy -u serpentine-copy-meta -n 100Both services include a watchdog timer. The scripts ping systemd every loop iteration via systemd-notify WATCHDOG=1. If a service becomes unresponsive, systemd will automatically restart it.
Key service settings:
Type=simple— Service runs in foregroundRestart=always— Auto-restart on failureRestartSec=10— Wait 10 seconds between restartsWatchdogSec— Timeout for watchdog monitoring (varies per service)User=rno-g— Runs as rno-g userStandardOutput=journal— Logs to systemd journal
Check logs for errors:
journalctl -u serpentine-copy -n 20 --no-pagerCommon issues:
- SSH key not set up for passwordless authentication
- Source/destination directories don't exist
- Permission issues with data directories
Check if rsync is stuck or endlessly restarting:
ps aux | grep rsync
make statusIf you see "watchdog timeout" errors:
- The script may be too slow; consider increasing
WatchdogSecin the service file - Check network connectivity to DESY server
serpentine/
├── serpentine-copy # Main data sync script (continuous)
├── serpentine-copy-meta # Metadata sync script (continuous)
├── copy-data # Manual file copy utility (on-demand)
├── serpentine-copy.service # Systemd service for serpentine-copy
├── serpentine-copy-meta.service # Systemd service for serpentine-copy-meta
├── Makefile # Installation and management automation
└── README.md # This file