How to set automatic security updates in CentOS?

I have followed https://www.tecmint.com/auto-install-security-patches-updates-on-centos-rhel/ steps in this link and created the below bash script that could do all the steps in one go.

`#!/bin/bash

yum -y install yum-cron systemctl start yum-cron systemctl enable yum-cron

sed -i -e 's/update_cmd = default/update_cmd = security/g' /etc/yum/yum-cron.conf sed -i -e 's/apply_updates = no/apply_updates = yes/g' /etc/yum/yum-cron.conf

systemctl restart yum-cron`

But later I found this link saying that yum --security upgrade won't work in centos. https://www.caseylabs.com/centos-automatic-security-updates-do-not-work/ Anyone know how to solve this?