- # Remember the previous sequence number
- prevSequenceNumber=$sequenceNumber
-
- # Read in new state
- . state.txt
-
- # Did we get any new data?
- if [ "${sequenceNumber}" == "${prevSequenceNumber}" ]
- then
- # Log the lack of data
- echo "No new data available. Sleeping..."
-
- # Remove file, it will just be an empty changeset
- rm ${file}
-
- # No need to rollback now
- rm state-prev.txt
-
- # Sleep for a short while
- sleep 30
- else
- # Log the new data
- echo "Fetched new data from ${prevSequenceNumber} to ${sequenceNumber} into ${file}"