How to set automatic security updates in CentOS?

I have followed steps in this link and created the below bash script that could do all the steps in one go.


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. Anyone know how to solve this?