Tips and tricks

Here are a few assorted “tips and tricks” for advanced users. Feel free to suggest some more!

Scripting / scheduling

Since WordShell is a command-line tool, it can be scripted and scheduled; e.g. you can use it in your crontab. For example, you could run this every week to send yourself a list of available updates:

wordshell all --listupdates

Trouble-shooting (quick login / get PHP information)

If you have a site that you need to investigate, you can use WordShell to quickly access it. With FTP sites, the following command will log you in (using lftp); with filesystem sites it will select the relevant directory and open up a bash prompt:
wordshell mysite --login

Run one of these two commands to get information on the PHP setup of the remote site:

wordshell mysite --phpversion
wordshell mysite --phpinfo

Find all third-party plugins

Use the –listonlythirdparty switch to find plugins that were not known at www.wordpress.org/extend/plugins – either because they are third-party, or because they were removed:

wordshell all --list --listonlythirdparty

Delete old backups

Whenever you update a plugin, the old version is backed up. After a while, you may want to delete the old backups, like so (e.g. to delete those older than 70 days):

wordshell --deleterollbacks=70

More verbose output

You can get a lot of information about what WordShell is doing internally by adding –debug to the command line (or even twice, for even more output).

Login via SSH key-based or Kerberos authentication

By default,¬†WordShell uses lftp to handle SFTP connections. In turn, by default lftp invokes “ssh -a -x” to perform login.
Therefore, any and all configuration files for lftp and for openssh can be used to configure the FTP connection; which usually means ~/.wordshell/lftp/rc and files in ~/.ssh. In general if you can set up your key-based login via the ssh program, then WordShell will work with it automatically.

Weird FTP server problems

This section is on its own page, here.

Advanced users

Remote CLI

WordShell has a remote command line for advanced users. This is officially unsupported, but provides many useful facilities. It allows you to directly run commands against the remote WordPress install. To enter this mode, specify the site and use –remotecli; e.g.:

wordshell mysite --remotecli

Or alternatively you can specify the command directly. For example, to request a core upgrade:

wordshell mysite --remotecli=coreupgrade

Results for a successful upgrade:

# wordshell mysite --remotecli=coreupgrade
AUTHOK:Downloading update from http://wordpress.org/wordpress-3.3.2-partial-1.zip...
Unpacking the update...
3.3.2

Or to fetch the version:

wordshell mysite --remotecli=wpversion

Reply:

AUTHOK:WPVERSION:3.3.2

Note that this is an internal interface, so command syntax is not guaranteed to remain stable. However you can fetch a list of current commands from the remote side with the command “help”.

Leave a Reply