anchor.diff:  
     # Clean up
     echo "Cleaning up"
  -  rm -rf /var/lib/mysql-bak $BASE_DIR $INCR_DIR
  +  rm -rf /var/lib/$TEMPDIR $BASE_DIR $INCR_DIR
   
     # Re-enable Puppet and run it to ensure passwords are updated
     govuk_puppet --enable && govuk_puppet
  
positive.code:   echo "Puppet is already disabled! Skipping environment sync and quitting"
    exit 1
  else
    # Create directories to restore into
    for dir in "$BASE_DIR" "$INCR_DIR"; do
      mkdir -p $dir
  
negative.code:   service mysql stop
  
    # Ensure that it's definitely not running before we move data directories
    if /bin/pidof mysqld; then
      echo "MySQL still running, exiting"
      exit 1
    fi
  
    # Copy the current directory to a backup location; we cannot move this if
    # the directory is a mount point so we need to copy
    echo "Backing up current dir"
    TEMPDIR=mysql-$(date '+%s')
    cp -R /var/lib/mysql /var/lib/$TEMPDIR
  
    # Remove contents of the datadir
    rm -rf /var/lib/mysql/*
  
    # Copy the restored data
    innobackupex --copy-back $BASE_DIR
  