backup script logic