I’m a great believer in automation; as one of my interviewers said to me once: If we do it twice; we automate it.
I adopted this style throughout my work; hence I wanted to show how would I upgrade/update the WordPress core and plugins using cron to keep all my blogs and sites secure and up to date with security patches.
1- get & install
2- write a script to use
wp-cli to update WordPress [see attached code]
# prevent errors snowball effect : stop at any process which exit with non success value (non zero)
# print current version | used for logs
wp core version
# upgrade core and database
wp core update
wp core update-db
# upgrade plugins
wp plugin update