Mount a fs using autofs with fail-over

I have 2 source IPs and common mount /SAP_01, mount the file system from 1st source IP if not available mount with 2nd IP and vise versa (kind of fail-over).

I create a script to check which IP is active

#!/bin/bash

primary="//192.168.10.200/SAP_01"
secondary="//10.25.9.200/SAP_01"
mount_point="/SAP_01"
cifs_port=445
log_file="/var/log/cifs_events"

log_event() {
    echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> $log_file
}

# Check if the mount point is stale
if mountpoint -q $mount_point && ! nc -z -w 1 192.168.10.200 $cifs_port && ! nc -z -w 1 10.25.9.200 $cifs_port; then
    log_event "Mount point is stale. Forcing unmount."
    umount -l $mount_point
fi

# Check if the primary server is available
if nc -z -w 1 192.168.10.200 $cifs_port; then
    log_event "Primary server is available. Mounting $primary."
    echo "$primary"
else
    log_event "Primary server is down. Checking secondary server."
    if nc -z -w 1 10.25.9.200 $cifs_port; then
        log_event "Secondary server is available. Mounting $secondary."
        echo "$secondary"
    else
        log_event "Neither CIFS server is available."
        echo "Neither CIFS server is available" >&2
        exit 1
    fi
fi

its working fine , it will give UNC patch //192.168.10.200/SAP_01 or //10.25.9.200/SAP_01

but I am not able to mount this via autofs

I added /etc/auto.master

/- /etc/auto.cifs

and /etc/auto.cifs

/SAP_01 -fstype=cifs,rw,uid=30000,gid=4010,file_mode=0777,dir_mode=0777,_netdev,credentials=/etc/cifs_credentials :/usr/local/bin/cifs_failover.sh

But while running autofs I am getting error

mount_mount: mount(generic): calling mkdir_path /SAP_01
mount_mount: mount(generic): calling mount -t cifs -o rw,uid=30000,gid=4010,file_mode=0777,dir_mode=0777,_netdev,credentials=/etc/cifs_credentials /usr/local/bin/cifs_failover.sh /SAP_01
>> mount.cifs: bad UNC (/usr/local/bin/cifs_failover.sh)
mount(generic): failed to mount /usr/local/bin/cifs_failover.sh (type cifs) on /SAP_01
dev_ioctl_send_fail: token = 370

Any solution to fix this ? I just want to fail-over if primary source unavailable and vise-versa.

Please help me to resolve this issue.

I just want to fail-over if primary source unavailable and vise-versa.