BackWPup s3 bucket does not exist after selecting it

This error is not very clear since BackWPup let’s you select your desired bucket from the list. If the bucket is already selected, how can it not exist? Anyways, I fixed this by switching the region from US-West-Oregon to US-Standard.

[INFO] BackWPup 3.3.6; A project of Inpsyde GmbH
[INFO] WordPress 4.7.2 on
[INFO] Log Level: Normal 
[INFO] BackWPup job: Weekly Backup
[INFO] Logfile is: backwpup_log_411491_2017-03-01_03-57-39.html
[INFO] Backup file is: backwpup_411491_2017-03-01_03-57-39.tar.bz2
[01-Mar-2017 03:57:39] 1. Try to backup database …
[01-Mar-2017 03:57:39] Connected to database example on localhost
[01-Mar-2017 03:57:39] Added database dump "example.sql.gz" with 290.23 KB to backup file list
[01-Mar-2017 03:57:39] Database backup done!
[01-Mar-2017 03:57:39] 1. Trying to make a list of folders to back up …
[01-Mar-2017 03:57:40] Added "wp-config.php" to backup file list
[01-Mar-2017 03:57:40] 1555 folders to backup.
[01-Mar-2017 03:57:40] 1. Trying to generate a file with installed plugin names …
[01-Mar-2017 03:57:40] Added plugin list file "Example.pluginlist.2017-03-01.txt.bz2" with 1.09 KB to backup file list.
[01-Mar-2017 03:57:40] 1. Trying to generate a manifest file …
[01-Mar-2017 03:57:40] Added manifest.json file with 5.99 KB to backup file list.
[01-Mar-2017 03:57:40] 1. Trying to create backup archive …
[01-Mar-2017 03:57:40] Compressing files as TarBz2. Please be patient, this may take a moment.
[01-Mar-2017 03:58:25] Backup archive created.
[01-Mar-2017 03:58:25] Archive size is 75.79 MB.
[01-Mar-2017 03:58:25] 10163 Files with 159.58 MB in Archive.
[01-Mar-2017 03:58:26] 1. Trying to send backup file to S3 Service …
[01-Mar-2017 03:58:26] ERROR: S3 Bucket "example-backup" does not exist!
[01-Mar-2017 03:58:26] ERROR: Job has ended with errors in 47 seconds. You must resolve the errors for correct execution.

Automating WordPress updates with cron and the wp-cli

Ain’t nobody got time to worry about updates. I’d rather have it break while updating than have it hacked by a script kiddie because I’ve neglected to login for a while. We will see if this ever breaks anything.

Install WordPress-CLI if you have not already.

Add all your sites to the script:

declare -a arr=(

for i in "${arr[@]}"
  echo $i
  cd /usr/share/nginx/html/$i
  sudo -u nobody wp core update

NOTE: Substitute /usr/share/nginx/html for the directory that holds your WordPress sites. Change user nobody to the user that owns the aforementioned directories. Check with ls -al, it might be the user that apache/nginx runs as, check that with top, htop, or ps -aux

Make sure it’s executable:

chmod +x

Run the script daily and live dangerously!

30 2 * * * bash /home/anthony/ >/dev/null 2>&1

Angular JS persisting data across controller instances

Where do we want to store our data in Angular JS and how does it flow through your web/mobile app. This is especially important if you are using Angular JS in the mobile context. Recently I’ve been working on some Ionic Framework apps. Here is my example.

The user leaves the page then navigates back. We are duplicating API calls and losing the users context within the data. Behind the scenes we did this:

  1. Initialize controller A
  2. Load data set A into controller A via API call
  3. Load page B
  4. Initialize controller A
  5. Load data set A into controller A via API call

Alternatively we could have done this:

  1. Initialize controller A
  2. Load data set A into service A via API call
  3. Pass data from service A to Controller A via a promise
  4. Load page B
  5. Initialize controller A
  6. Load cached data set A from service A

An example of a controller and service pairing might look like this (NOTE: This is specific to my Ionic Cordova mobile app, but you can get the idea. Also note that the more function returns a promise):

.controller('HotCtrl', function($scope, UtilService, HotService) {
 $scope.util = UtilService;
 $scope.movies = HotService.all();

 $scope.doRefresh = function() {
   $scope.movies = [];
   setTimeout(function() {
   }, 700);

 $scope.moreMovies = function() {
     $scope.movies = HotService.all();
     setTimeout(function() {
     }, 200);
     $scope.hasMore = HotService.hasMore();

.factory('HotService', ['$resource', 'MovieService', 'UtilService', function($resource, MovieService, UtilService) {
 var page = 1;
 var movies = [];
 var regions = UtilService.getRegions();
 var hasMore = true;
 return hotObj = {
   all: function() {
     if(regions !== UtilService.getRegions()) {
       regions = UtilService.getRegions();
     return movies;
   more: function() {
     options = {page: page, n: 'hot', per_page: 500};
     return MovieService.query(UtilService.getParams(options), null, function(response, headers){
       if(response.length < 1) {
         hasMore = false; 
       } else {
       hasMore = true;
     angular.forEach(response, function(value, key) {
       function(response) {
   get: function(index) {
     return movies[index];
   hasMore: function(){
     return hasMore;
   clear: function() {
     page = 1;
     movies = [];
     hasMore = true;

Angular JS reusable controller functions

So this problem initially started when I found myself repeating similar functions across controllers. I also wanted to be able to access these functions from the view, which is why they are attached to the $scope. Notice both controllers contain the same function. I suppose we could attach this function to the $rootScope but that sounds messier and harder to test. Also referencing that from the view would not be as clean.

<a href="" ng-click="linkTo('')" />

app.controller('MoviesCtrl',['$scope', function($scope){
  $scope.linkTo = function(link) {, '_system');

app.controller('TvShowsCtrl',['$scope', function($scope){
  $scope.linkTo = function(link) {, '_system');

My preferred solution is to this is

<a href="" ng-click="util.linkTo('')" />

app.factory('UtilService', function() {
  return {
    linkTo: function(link) {, '_system');

app.controller('MoviesCtrl',['$scope', 'UtilService', function($scope, UtilService){
  $scope.util = UtilService;

I like to use a utility service like this dry out my controllers. This was especially useful in my most recent Ionic Cordova app.