BASH Script for WordPress Backups

A lot of people are worried about backing up their WordPress installs on a regular basis. I know. I get that. Here’s a script you can use if you have access to the shell. Put this sucker on cron (For many Linux distributions, you can put it in

1
/etc/cron.daily

if you have root access. Otherwise, use whatever mechanism your hosting provider offers for cronjobs/scheduled tasks.

Also note that while this script will work fine for most Linux distributions, you should know that every distribution is different and minor modifications may be necessary.

Standard Disclaimer: This script is free of charge and, thus, unsupported. Functionality is neither guaranteed nor implied. I work as a consultant and have many years making WordPress work for companies and individuals. If you want support, you have to pay but I’d be happy to work with you. Contact me for paid work only at aaron@technosailor.com.

With all that done, here’s the script. Make sure you remember to edit the appropriate variables and make it executable.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
#### DO NOT EDIT
DATE=`date +-%y-%m-%d--%T`

#### EDIT BELOW

# If CREATE_ZIP is 0, then a tarball will be used (default). If 1, then a zip file will be used
CREATE_ZIP=0
# Accessible/writable directory for temp storage
TMPDIR=/tmp
# Absolute path to WordPress backup storage location
WPBACKUP=/backups
# Absolute path to WordPress install.
WPDIR=/path/to/wordpress
# Enter Database connection details from your wp-config.php file
WP_DBUSER=user
WP_DBPASS=password
WP_DBHOST=localhost
WP_DBNAME=dbname

#### STOP EDITING
if [ ! -d $TMPDIR ]; then
    mkdir $TMPDIR/backup
fi

if [ ! -d $WPBACKUP ]; then
    mkdir $WPBACKUP
fi

# Dumps the database
mysqldump -h$WP_DBHOST -u$WP_DBUSER -p$WP_DBPASS $WP_DBNAME > $TMPDIR/backup/wordpress-db.sql
 
# Create Archive
if [[ CREATE_ZIP -eq 0 ]]; then
    # Tarballs the Database and WP files
    tar -cvf $TMPDIR/backup/backup$DATE.tar $WPDIR/.htaccess $WPDIR/wp-content $TMPDIR/backup/wordpress-db.sql 2>&1
    gzip $TMPDIR/backup/backup$DATE.tar
    # Move archive to backup location
    mv $TMPDIR/backup/backup$DATE.tar.gz $WPBACKUP/
else
    # Zips the database and WP files
    zip $TMPDIR/backup/backup$DATE.zip $WPDIR/.htaccess $WPDIR/* $TMPDIR/backup/wordpress-db.sql 2>&1
    # Move archive to backup location
    mv $TMPDIR/backup/backup$DATE.zip $WPBACKUP/
fi

The Best Business Smartphone Available (Today)

Chances are, if you are reading this blog, then you have some affinity to technology and that you’re in the business of technology (whether directly, or using technology to do your job – and I don’t mean having a computer on your desk at work). This is a pretty tech-savvy crowd around these parts so I’m guessing that most of you own a smartphone of some sort. Many have iPhones. Perhaps as many have BlackBerrys. A few of you are sad, sad people who own Treos.

A swath of new smartphones have just hit the market and, though I don’t claim to be a gadget or phone blogger (Really, you need to go read Boy Genius and Gizmodo for a far more geeky and informative analysis of all the various devices that hit the market), I do know that I’m a businessman and entrepreneur. I know that, from my perspective, there are key principles and requirements in any phone.

In order for a businessperson or entrepreneur to invest in a phone (again, from my perspective), there needs to be a few key things.

  1. Email – Clearly the killer app forever now, any phone must support email. As part of this, there needs to be a wireless sync/push feature.
  2. Productivity – Any smartphone needs to be able to open files from major vendors – Word, Excel, PDFs, Images, etc.
  3. Competent mobile browser – As mobile professionals, we need the web more than the average home user. We need access to sites that are not inherently broken because they appear on the mobile device.
  4. Reliable network – This is not a plug for Verizon because several U.S. and international carriers can be considered “reliable”. Whatever the network that the phone is on, it needs to be reliable.
  5. Third Party Applications – How easy is it to add apps that you need to your phone? Are there quality apps available or not?
  6. Copy and Paste – One of those “Duh” features that is essential.

You may notice some notable omissions from this list that emphasize the angle of business utility. For instance, cameras, WiFi and GPS are all nice but unnecessary for business. Touch screens, such as the one that comes with the iPhone or BlackBerry Storm are also nice additions, but not required for business utility.

In my mind, there are three phones on the market that are worth considering for business use. I have my preference on which one is best, but businesses all have to decide what their needs are and, if they are practical, choose among one of these three devices.

Apple iPhone 3G S

apple-iphone-3gThe third generation iPhone just hit the market on June 19th. It boasts all of the features of the iPhone 3G plus a quicker OS and a better camera. Most of the new features of the iPhone are available via an OS 3.0 upgrade available for free for older iPhone owners. With the new iPhone, you can tether your iPhone for broadband access on your laptop (except AT&T customers in the US), and an all important Remote Wipe capability that will allow network administrators to remove sensitive data in case the phone is lost or stolen. Cost: $199 with new two year contract from AT&T (US)

Pros

  • Huge number of third party apps including many business apps via the iTunes App Store
  • Remote Wipe
  • Intuitive touch screen
  • WiFi or 3G connectivity

Cons

  • AT&T as the carrier in the United States has been hugely unreliable delivering even basic services like voice mail
  • Exorbitant data plan fees
  • Large glass screen lends itself to breakage
  • Insecure Microsoft Exchange integration
  • Inability to multi-task applications

Palm Pre

palm-prePalm used to be the dominant manufacturer of handheld devices. With the rising popularity of BlackBerrys and iPhones, Palm has slipped tremendously. They recently, however, came to market with a very sleek phone that has an open development structure with their WebOS. Unlike the iPhone, the Pre does a very good job of multitasking and with it’s touch screen, switching between open applications is a smooth process. Also unlike the iPhone, the Pre provides a physical keyboard that, while somewhat awkward to use, should appease users who like the tactile feel of actual keys. Cost: $199 with new two year contract from Sprint.

Pros

  • Small form factor
  • Sprint has a very good data network
  • Bright HVGA screen (touch screen)
  • Email and integration with Microsoft Exchange
  • WiFi or 3G connectivity
  • Classic Konami Nintendo game Contra code to unlock developer mode. Geek Props.

Cons

  • Screen is much smaller than the iPhone
  • Awkward slide out keyboard with tiny keys makes typing difficult
  • Third party application availability is limited at this time
  • No Remote Wipe, a security requirement that might prevent large scale adoption in enterprise

BlackBerry Tour 9630

blackberry-tour-96301For BlackBerry afficionados, the new BlackBerry Tour (available for both Sprint and Verizon Wireless) is a beautiful phone. It has the brilliant screen (if slightly smaller version) as the BlackBerry Bold from AT&T and the form factor and keyboard styling of the new BlackBerry Curve 8350i (from Sprint). It has all the Enterprise integration that BlackBerry has been known for including remote wipe and Exchange integration (via Blackberry Enterprise Server for Exchange). Cost: $199 with new two year contract on Sprint or Verizon Wireless

Pros

  • Familiar usability for BlackBerry users
  • OS 4.7, which includes a usable browser (departure from the norm)
  • Multi-tasking applications

Cons

  • No touch screen
  • Awkward position of MicroUSB slot makes it difficult for right handed users to use the device while it is plugged in
  • Still no competent native Mac support, though this is supposedly coming soon.

At the end of the day, each organization needs to determine what is best for them. iPhones are fantastic devices for custom applications and is being used in the military, enterprise and government alike. They are not the most secure devices though and, for now, require AT&T in the U.S. The Palm Pre offers a significant value for businesses, but lacks Enterprise features such as remote wipe. It is also the first generation model of this phone. The BlackBerry is the most utilitarian phone and remains popular for businesses but its lack of a touch screen, the likes of which Apple has made us expect and long for, makes it “meh” for some users.

Whatever works for you.

Trends in Publishing, Advertising and Paid Subscription Model

The economic downturn is hitting everyone hard. Online content models and advertising is one of the harder hit areas. Long before the beginning of the market freefall, advertising revenues began declining. Evidence shows that, while print and television advertising is declining at an incredible rate, online advertising is not faring much better. The saving grace in online advertising is that, while it is declining, it is declining at a lower rate than offline advertising.

However, it is still declining.

The days of making money online via advertising would, by most accounts, seem to be over and with it comes the question, “How exactly do we make our industry profitable again?”

Conventional wisdom suggests that there are two models. The first is the advertising model. The second is a paid subscription model. Though we have been brainwashed to expect free at every turn, part of me wonders if a paid subscription model would work better. Surely, readers are willing to pay a small fee for access to valuable content?

For my part, I am considering a switch to a paid model. It is my belief that the content found here is worth paying a small fee for. In exchange, such a model would eliminate advertising and would probably be in the neighborhood of $5 a month. But I want to talk to you first.

Does this make sense to you? Would you be willing to support the emergence of a new model that benefits the larger community and how content business models evolve for a low price?