Space check logic for production/backup run in function