anchor.diff:  do
       # Work out the name of the next file
       file="changes-${sequenceNumber}.osm.gz"
  +
  +    # Save state file so we can rollback if an error occurs
  +    cp state.txt state-prev.txt
   
       # Fetch the next set of changes
       osmosis --read-replication-interval --simc --write-xml-change file="${file}" compressionMethod="gzip"
  
positive.code: # Setting to midnight ensures we get conistent data after first run
  # osmosis --read-replication-interval-init
  
  # Send output to the log
  exec > /var/log/tile/replicate.log 2>&1
  
  # Change to the replication state directory
  cd /var/lib/replicate
  
  # Read in initial state
  . state.txt
  
negative.code: 	    # 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
  