def batch_cmd_create_index_dl3(dl3_dir, parent_job_list):
    """Build batch command to create the observations index."""
    parent_job_list_str = ",".join(parent_job_list)
    log_dir = dl3_dir / "log"
    log_dir.mkdir(exist_ok=True, parents=True)
    log_file = log_dir / "create_index_dl3_%j.log"

    return [
        "sbatch",
        "--parsable",
        "--mem=8GB",
        "--job-name=dl3_index",
        f"--dependency=afterok:{parent_job_list_str}",
        "-D",
        dl3_dir,
        "-o",
        log_file,
        "lstchain_create_dl3_index_files",
        f"-d={dl3_dir}",
        f"-o={dl3_dir}",
        "-p=dl3*.fits.gz",
        "--overwrite",
    ]