Console

The Console is Automad's command line interface. It lets you run system tasks such as clearing the cache, changing the configuration, creating users or updating Automad from a terminal. This is useful for automated deployments, scripts or in case you can't access the dashboard.

Usage

The Console requires shell access to your server, for example via SSH. Change to the Automad base directory, which is the directory that contains the index.php file, and run a command as follows:

php automad/console command [--arg value ...]

Running php automad/console without a command prints the installed version and a list of all available commands together with their arguments and examples.

Commands

The following table lists all available commands. Arguments are passed in the form of --name value.

CommandDescription
cache:clearClears the page cache.
cache:purgePurges the entire cache directory, including all cached images and deleted pages.
config:setSets a configuration value. Requires the --key and --value arguments.
config:unsetRemoves a configuration value and restores its default. Requires the --key argument.
import:v1Imports the content of a site made with Automad version 1. Requires the --path argument.
log:clearRemoves the debug log file.
log:pathPrints the path of the debug log file.
migrateRuns all setup migrations manually.
updateUpdates Automad to the latest version.
user:createCreates a new user account. The --email, --username and --password arguments are optional.

Examples

The following sections show some common tasks that can be solved with the Console.

Changing the Configuration

The config:set and config:unset commands change the configuration file without editing it manually. The following command disables the page cache:

php automad/console config:set --key AM_CACHE_ENABLED --value 0

Numeric values are stored as numbers and all other values as strings. Therefore use 1 and 0 for options that are switched on and off. In order to restore the default value, remove the option again:

php automad/console config:unset --key AM_CACHE_ENABLED

Creating a User

In case you have lost access to all accounts, you can create a new one on the command line. A random username and password are generated when they are not passed as arguments, and the credentials are printed to the terminal. See User Accounts for more details.

php automad/console user:create --email userdomaincom

Following the Debug Log

When debugging is enabled, Automad writes log messages to a file outside of the document root. The log:path command prints the location of that file, so that you can follow it on Linux or macOS using tail:

tail -F $(php automad/console log:path)

Run php automad/console log:path --help for more examples, such as filtering the log with grep.

Running Migrations

After every update, Automad runs a set of migrations that bring existing data up to date. The migrate command runs them manually, for example in order to encrypt all existing secrets right after adding an encryption key, as described in Encrypting Secrets. Running the migrations more than once is safe.

php automad/console migrate

Updating Automad

The update command checks for a newer version and installs it. It works the same way as the update in the System Settings of the dashboard. Make sure to create a backup before updating.

php automad/console update

Importing a Version 1 Site

The import:v1 command imports the pages, shared data and files of an existing Automad 1 site into a fresh version 2 installation. The current pages and shared directories are kept as backups. Read Coming from Version 1 before starting the import.

php automad/console import:v1 --path /path/to/automad-v1
Themes Backups