I am having an issue with missing files while copying and moving them. To give a bit of background,
I have a crontab job that starts when file arrives into a communication server. I need these files in another server, so I am copying to the server before processing those file.
#!/bin/bash
######
#####
### Set initial time of file
LTIME=`stat -c %Z /mnt/deliverFiles/*.txt`
while true
do
ATIME=`stat -c %Z /mnt/deliverFiles/*.txt`
if [[ "$ATIME" != "$LTIME" ]]
then
scp -p /mnt/deliverFiles/*.txt server:/home/files/
mv /mnt/deliverFiles/*.txt /home/files/
echo "Fertig."
LTIME=$ATIME
fi
sleep 5
done
I don’t receive all the files into server. can anyone help here with a better Idea?