Moosh – the Moodle shell

Before you can make use of Moosh, you will have to install it (see Chapter 8, Moodle Plugins). Once it's been installed, you have a vast number of commands (at the time of writing over 80!) at your disposal.

The general syntax of Moosh is as follows:

moosh <command> <options>

To give you an idea of the types of things you can do with Moosh, we will show you a number of examples.

Tasks

Commands

Description

Clear cache

moosh cache-clear

This is the equivalent of purge_caches using CLI

Show all plugin types

moosh info-plugins

Displays a list of all installed plugins and their installation location.

Create a user

moosh user-create test

Create a user with user name test.

Create 10 users

moosh user-create test{1..10}

This type of enumeration can be used with a number of Moosh commands.

Create a user with some optional values

moosh user-create --email [email protected] --city "Heidelberg" --country DE --firstname "Alex" --lastname "Büchner" mcbuchner

All values are supported; this is just a sample.

Show all files in a course

moosh file-list course=99

Outputs information on all files in course with ID 99. There are more file-related commands, such as showing the system path of a file or the ability to upload files directly.

Once you combine Moosh commands with standard shell commands via pipes and streams, you have a powerful arsenal of commands at hand. For example, you might want to find all backups that are larger than 10 MB, archive them, and reclaim the space.

The following example output of Moosh shows the output of the config-get command, which lists the value(s) of all configuration settings in Moodle:

Moosh – the Moodle shell

For a full list of well over 80 commands and hundreds of options, please refer to the Moosh site at http://moosh-online.com/commands/. The list is growing constantly, so make sure you have the latest version installed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.30.236