anchor.diff:  # stop openvpnas
   /etc/init.d/openvpnas stop
   
  +rm -f $OPENVPNAS_DIR/etc/db/*.db
  +
   # iterate the database files
  -for DBNAME in *.db
  +for DBNAME in *.db.dump
   do
     echo "restoring $DBNAME"
  -  $OPENVPNAS_DIR/scripts/sqlite3 $OPENVPNAS_DIR/etc/db/$DBNAME < $DBNAME.dump
  +  $OPENVPNAS_DIR/scripts/sqlite3 $OPENVPNAS_DIR/etc/db/${DBNAME%.dump} < $DBNAME
   done
   
   # start openvpnas
  
positive.code: 
  # Generated by Chef
  
  # ./usr/local/openvpn_as/scripts/sqlite3 <[TEXT_FILE] [DB_FILE]
  
  # /usr/local/openvpn_as/etc
  # certs.db
  
negative.code: 
  # download the latest backup
  RESTORE_NAME=$(/usr/local/bin/aws s3 ls s3://$RESTORE_BUCKET | grep -o 'openvpnas-backup[^\n]*' | tail -1)
  /usr/local/bin/aws s3 cp s3://$RESTORE_BUCKET/$RESTORE_NAME openvpnas-backup.tar.gz
  
  # extract the backup to the temp dir
  
  