{"id":620,"date":"2015-04-21T16:02:17","date_gmt":"2015-04-21T20:02:17","guid":{"rendered":"https:\/\/www.devolve.net\/blog\/?p=620"},"modified":"2018-07-13T10:08:08","modified_gmt":"2018-07-13T14:08:08","slug":"scripted-wordpress-upgrades","status":"publish","type":"post","link":"https:\/\/www.devolve.local\/scripted-wordpress-upgrades\/","title":{"rendered":"Scripted WordPress Upgrades"},"content":{"rendered":"

This command line interface for administering WordPress is called wp-cli<\/a>. It’s pretty great.<\/p>\n

I wrote a script to run from cron for updating a bunch of different WP installs in the same directory.<\/p>\n

#!\/bin\/sh\r\n\r\nbase='\/serve\/www'\r\ncd \"$base\" || { echo 'web base dir - could not change dir.' && exit 1; }\r\nwpcli=`which wp`\r\n[ -x \"$wpcli\" ] || { echo 'wp-cli not found.' && exit 2; }\r\n\r\nfor i in `\/bin\/ls | grep -v wordpress`; do\r\n  if [ -f \"$i\"\/wp-includes\/version.php ]; then\r\n    cd \"$base\/$i\"\r\n    $wpcli core update\r\n    $wpcli theme update --all\r\n    $wpcli plugin update --all\r\n    cd -\r\n  fi\r\ndone<\/pre>\n","protected":false},"excerpt":{"rendered":"

This command line interface for administering WordPress is called wp-cli. It’s pretty great. I wrote a script to run from cron for updating a bunch of different WP installs in the same directory. #!\/bin\/sh base=’\/serve\/www’ cd “$base” || { echo ‘web base dir – could not change dir.’ && exit 1; } wpcli=`which wp` [ […]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[34,26,49],"_links":{"self":[{"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/posts\/620"}],"collection":[{"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/comments?post=620"}],"version-history":[{"count":2,"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/posts\/620\/revisions"}],"predecessor-version":[{"id":622,"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/posts\/620\/revisions\/622"}],"wp:attachment":[{"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/media?parent=620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/categories?post=620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devolve.local\/wp-json\/wp\/v2\/tags?post=620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}