#!/bin/bash #Endlessloop to sync while true do #var Hostname HOST='localhost' #var Username USER='root' #Path to FTPLogfile LOGPATH=/var/log/ftprsync.log #Path to FTP data FTPPATH=/var/ftp/ #Path to local directory PATH=/var/textfiles/ #check if there are textfiles to sync if ssh $USER@$HOST "ls $FTPPFAD*.txt" >/dev/null 2>&1 then #if there are textfiles sync them to the localdir and remove them from FTP #log number of files, speed, which files... to the logfile. -q (quiet) only shows error in shell nothing else rsync --remove-source-files --stats --progress --log-file=$LOGPATH -q ${USER}@${HOST}:$FTPPATH*.txt $PATH fi #short wait time -> less cpu usage sleep 5 done