Bake Fluid Simulation via CLI or Python?
It's a bit more complicated than it could be because fluid simulating baking is only exposed as an operator. That means it expects an active object in the context, which is usually provided by the user interface that is not available in background mode.

It is possible to pass this object to the operator manually however. The following is an example script that bakes all fluid domain objects in all scenes:

import bpy

for scene in bpy.data.scenes:
    for object in scene.objects:
        for modifier in object.modifiers:
            if modifier.type == 'FLUID_SIMULATION':
                if modifier.settings.type == 'DOMAIN':
                    bpy.ops.fluid.bake({'scene': scene, 'active_object': object})
                    break


This works when executed from the command line with a command like this:

blender --background file.blend --python script.py