Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.
Commentaire: Published by Scroll Versions from space DA and version BM-4.0
Sv translation
languagefr

Présentation

Le client CLI (« Command Line Interface » = Interface de lignes de commandes) permettant d'effectuer des tâches d'administration de la plateforme BlueMind directement en ligne de commande, sans avoir à créer de scripts pour cela.

Couplé au système de monitoring bm-tick, il permet notamment des tâches d'administration de celui-ci.

Cette page vous présente l'utilisation du client, avec des exemples pratiques. Vous retrouverez dans la sous-page dédiée la Référence détaillée des commandes bm-cli.

Installation

Le client bm-cli est installé par défaut dans BlueMind 4.

Un composant additionnel permettant des opération de gestion de mapi pour Outlook est, lui, optionnel et peut être installé simplement en installant le paquet correspondant :

Bloc de code
$ aptitude install bm-plugin-cli-mapi
Info

Aucun redémarrage de service n'est nécessaire, les commandes sont directement utilisables

Volet
borderWidth3

Sur cette page :

Sommaire
maxLevel2

En rapport :

Reference des commandes bm-cli

Fonctionnement

Les commandes

Les commandes sont passées via un terminal directement sur le serveur, connecté en ssh par exemple.

Par exemple, une commande permettant de connaître les carnets d'adresses d'un utilisateur :

Bloc de code
root@mail:~# bm-cli contact list jdoe@bluemind.loc
{"owner":"05E25C2C-3643-4ED2-997C-4A4F39933D18","uid":"book:Contacts_05E25C2C-3643-4ED2-997C-4A4F39933D18","name":"My contacts"}
{"owner":"05E25C2C-3643-4ED2-997C-4A4F39933D18","uid":"book:CollectedContacts_05E25C2C-3643-4ED2-997C-4A4F39933D18","name":"Collected contacts"}
{"owner":"05E25C2C-3643-4ED2-997C-4A4F39933D18","uid":"408C741B-3FDC-44B6-B1FD-19E79404BFCF","name":"Perso"}

Obtenir de l'aide

Remarque

Les commandes sont enrichies au fur et à mesure des versions de BlueMind. Il se peut donc que vous ayez plus (ou moins) de commandes selon la version de votre installation.

Il est donc important de se référer à la commande "bm-cli help" afin de savoir quelles sont celles que vous pouvez utiliser.

Par exemple :

Bloc de code
# bm-cli help
usage: bm-cli <command> [<args>]

The most commonly used bm-cli commands are:
    calendar      calendar task(s)
    contact       contact task(s)
    help          Display help information
    maintenance   maintenance task(s)
    tick          tick task(s)
    user          user task(s)

See 'bm-cli help <command>' for more information on a specific command.

L'installation, ici en 3.5.11, bénéficie ici des commandes calendar, contact et user qui n'étaient pas présentes sur les versions antérieures.

À tout moment vous pouvez obtenir de l'aide sur une commande, une sous-commande, son usage et ses options au moyen de "help".

Par exemple "help maintenance" vous présente la commande maintenance et ses diverses actions possibles :

Bloc de code
# bm-cli help maintenance
NAME
        bm-cli maintenance - maintenance task(s)

SYNOPSIS
        bm-cli maintenance
        bm-cli maintenance consolidateIndex [--workers <workers>]
        bm-cli maintenance list [--workers <workers>]
        bm-cli maintenance repair [--dry] [--workers <workers>]

COMMANDS
        With no arguments, List directory entries

        list
            List directory entries
...

Pour obtenir plus de détail sur une sous-commande, il vous suffit de taper la sous-commande à son tour, ici pour obtenir l'aide concernant l'opération de consolidation d'index :

Bloc de code
# bm-cli help maintenance consolidateIndex
NAME
        bm-cli maintenance consolidateIndex - Consolidate a mailbox index

SYNOPSIS
        bm-cli maintenance consolidateIndex [--workers <workers>] [--] <target>

OPTIONS
        --workers <workers>
            run with X workers
...

Exemples pratiques

Administration & Maintenance

Effectuer un check&repair global

La commande suivante permet d'effectuer l'opération "valider et réparer" sur l'ensemble des utilisateurs du domaine en utilisant 4 threads :

Bloc de code
bm-cli maintenance repair domain.net --workers 4

Modifier le mot de passe admin0

Pour diverses raisons, techniques ou pratiques (en cas de perte, par exemple), il peut être utile de modifier le mot de passe de l'utilisateur admin0 sans avoir à se loguer dans BlueMind.

La commande suivante permet de le faire sans connaître l'ancien mot de passe :

Bloc de code
bm-cli user update admin0@global.virt --password "NewPassword"

Mettre à jour la configuration tick

Lorsque l'outil de monitoring Bm-Tick est installé, il est possible d'effectuer des tâches d'administration sur celui-ci. Par exemple, vous pouvez redéployer la configuration sur l'ensemble des serveurs du domaine avec la commande suivante :

Bloc de code
# bm-cli tick reconfigure
Astuce

L'option --dry permet de tester la commande : l'opération est juste simulée

Bloc de code
# bm-cli tick reconfigure --dry

Mettre à jour BlueMind

À partir de BlueMind 4.1, si la souscription le permet et que les paquets adéquats sont installés, la mise à jour de BlueMind peut se faire complètement en ligne de commande, sans passer par l'exécution de l'assistant via navigateur :

Tabs group
borderall-sides
navcolornavy
Debian/UbuntuRedhat/CentOS

Gestion des utilisateurs

Supprimer les utilisateurs archivés (suspendus) du domaine

Les commandes peuvent être couplées afin d'effectuer plusieurs opérations en une seule fois.

Par exemple, avec la commande ci-dessous on recherche les adresses emails des utilisateurs suspendus :

Bloc de code
bm-cli user get domain.net --archived --display "email"

Il est alors possible de coupler le retour de cette commande avec une commande "delete" afin de supprimer les utilisateurs retournés :

Bloc de code
bm-cli user get local.lan --display "email" | jq -r '.[].email' > /tmp/archived.txt
while read account; do bm-cli user delete --dry $account ;done < /tmp/archived.txt

Opérations sur les calendriers

Partager les calendriers de tous les utilisateurs vers un utilisateur

Il peut s'avérer utile qu'un utilisateur ait des droits d'accès sur les calendriers de tous les autres utilisateurs sans pour autant qu'il soit désigné administrateur (par exemple une secrétaire devant pouvoir voir/créer des événements pour l'ensemble des collaborateurs). Afin d'éviter la tâche laborieuse de passer sur toutes les fiches d'administration des utilisateurs pour activer un partage, il est possible de réaliser cela en ligne de commande.

Cette opération n'est pas réalisable en une seule commande, néanmoins il est possible de réaliser une boucle récupérant l'ensemble des utilisateurs du domaine puis activant un partage pour chacun d'eux :

Bloc de code
bm-cli users get domain.net > /tmp/allUser.domain.net
while read account; do bm-cli calendar share $account « default » toto@domain.net r;done < /tmp/allUser.domain.net

Opérations sur les contacts

Exemple de procédure pour nettoyer le carnet des collectés d'un utilisateur puis transférer les contacts vers son carnet personnel (en testant au préalable l'import) :

Bloc de code
root@mail:~# bm-cli contact list jdoe@bluemind.loc
{"owner":"05E25C2C-3643-4ED2-997C-4A4F39933D18","uid":"book:Contacts_05E25C2C-3643-4ED2-997C-4A4F39933D18","name":"My contacts"}
{"owner":"05E25C2C-3643-4ED2-997C-4A4F39933D18","uid":"book:CollectedContacts_05E25C2C-3643-4ED2-997C-4A4F39933D18","name":"Collected contacts"}
{"owner":"05E25C2C-3643-4ED2-997C-4A4F39933D18","uid":"408C741B-3FDC-44B6-B1FD-19E79404BFCF","name":"Perso"}
root@mail:~# bm-cli contact deduplicate jdoe@bluemind.loc --addressbook-uid book:CollectedContacts_05E25C2C-3643-4ED2-997C-4A4F39933D18
2 were removed out of 35
root@mail:~# bm-cli contact export jdoe@bluemind.loc --vcf-file-path /tmp/jdoe-collected.vcf --addressbook-uid book:CollectedContacts_05E25C2C-3643-4ED2-997C-4A4F39933D18
addressbook book:CollectedContacts_05E25C2C-3643-4ED2-997C-4A4F39933D18 of jdoe@bluemind.loc was exported
root@mail:~# bm-cli contact import jdoe@bluemind.loc --vcf-file-path /tmp/jdoe-collected.vcf --addressbook-uid 408C741B-3FDC-44B6-B1FD-19E79404BFCF --dry
DRY : AddressBook 408C741B-3FDC-44B6-B1FD-19E79404BFCF of jdoe@bluemind.loc was imported
root@mail:~# bm-cli contact import jdoe@bluemind.loc --vcf-file-path /tmp/jdoe-collected.vcf --addressbook-uid 408C741B-3FDC-44B6-B1FD-19E79404BFCF
AddressBook 408C741B-3FDC-44B6-B1FD-19E79404BFCF of jdoe@bluemind.loc was imported
root@mail:~# bm-cli contact reset jdoe@bluemind.loc --addressbook-uid book:CollectedContacts_05E25C2C-3643-4ED2-997C-4A4F39933D18
Addressbook book:CollectedContacts_05E25C2C-3643-4ED2-997C-4A4F39933D18 of jdoe@bluemind.loc was reset
Sv translation
languageen

Introduction

With BlueMind 3.5.10 you can install a CLI (Command Line Interface) which can be used to perform BlueMind administration tasks in command line without having to create scripts.

When coupled with the bm-tick monitoring system, it can be used, among others, to manage it.

This page provides installation and use information, including practical examples. A dedicated sub-page provides more details on bm-cli command references.

Volet
borderWidth3

On this page:

Sommaire
maxLevel2

Related:

Reference des commandes bm-cli

Installation

Remarque

If you haven't updated BlueMind to the latest published version, there may be a conflict between the packages installed because bm-cli will install its latest available version.

To avoid this, you can:

  • either update your BlueMind installation beforehand (recommended solution)
  • or force the version number in the subscription before installing bm-cli in the same version as your BlueMind.
    To do this, edit the file /etc/apt/sources.list.d/bm.list and remplace "3.5" by the version number you want to use in the url:

Bloc de code
#deb https://SUBSCRIPTION_USER:PASSWORD@pkg.bluemind.net/3.5/xenial/pkgs /
deb https://SUBSCRIPTION_USER:PASSWORD@pkg.bluemind.net/3.5.12-4/xenial/pkgs

Note: we recommend that you copy the command line – as above – and comment the first version by adding # at the beginning of the line. This will make going back easier.
when you do this, the version for your entire BlueMind installation is frozen. Once the packages are installed, remember to change the version number back to the generic number so that you can update BlueMind in due course.

The bm-cli client is installed through a dedicated package on the server – available from BlueMind 3.5.10:

Bloc de code
# aptitude install bm-cli
Info

No restart is required, the commands are effective immediately.

Using the client

Commands

Commands are passed using a terminal straight onto the server, connected via ssh for instance.

For example, the following command can help you find out a user's address books:

Bloc de code
root@mail:~# bm-cli contact list jdoe@bluemind.loc
{"owner":"05E25C2C-3643-4ED2-997C-4A4F39933D18","uid":"book:Contacts_05E25C2C-3643-4ED2-997C-4A4F39933D18","name":"My contacts"}
{"owner":"05E25C2C-3643-4ED2-997C-4A4F39933D18","uid":"book:CollectedContacts_05E25C2C-3643-4ED2-997C-4A4F39933D18","name":"Collected contacts"}
{"owner":"05E25C2C-3643-4ED2-997C-4A4F39933D18","uid":"408C741B-3FDC-44B6-B1FD-19E79404BFCF","name":"Perso"}

Getting help

Remarque

Commands are improved with every version of BlueMind. You may have more or fewer commands depending on the version you have installed.

Make sure you check the "bm-cli help" command to find out which commands are available.

E.g.:

Bloc de code
# bm-cli help
usage: bm-cli <command> [<args>]

The most commonly used bm-cli commands are:
    calendar      calendar task(s)
    contact       contact task(s)
    help          Display help information
    maintenance   maintenance task(s)
    tick          tick task(s)
    user          user task(s)

See 'bm-cli help <command>' for more information on a specific command.

This installation – version 3.5.11 – includes calendar, contacts and user commands which did not exist in earlier versions.

You can get help on a command, sub-command, how to use it and its options using "help" at any time.

E.g. "help maintenance" shows the maintenance command and the actions it can perform:

Bloc de code
# bm-cli help maintenance
NAME
        bm-cli maintenance - maintenance task(s)

SYNOPSIS
        bm-cli maintenance
        bm-cli maintenance consolidateIndex [--workers <workers>]
        bm-cli maintenance list [--workers <workers>]
        bm-cli maintenance repair [--dry] [--workers <workers>]

COMMANDS
        With no arguments, List directory entries

        list
            List directory entries
...

For more details about a sub-command, type it to get help, e.g. about index consolidation:

Bloc de code
# bm-cli help maintenance consolidateIndex
NAME
        bm-cli maintenance consolidateIndex - Consolidate a mailbox index

SYNOPSIS
        bm-cli maintenance consolidateIndex [--workers <workers>] [--] <target>

OPTIONS
        --workers <workers>
            run with X workers
...

Practical examples

Administration and Maintenance

Performing a domain-wide check&repair 

The following command is used to perform a "check and repair" on all domain users using 4 threads:

Bloc de code
bm-cli maintenance repair domain.net --numworkers 4

Changing the admin0 password

For multiple reasons – technical or practical, e.g. in case of loss -- you may need to change the admin0 user's password without logging into BlueMind.

The following command allows you to do this without knowing the old password:

Bloc de code
bm-cli user update admin0@global.virt --password "NewPassword"

Updating Tick configuration

When the Bm-Tick monitoring tool is installed, you can use it to perform administration tasks. E.g. you can roll out the configuration on all domain servers again using the following command:

Bloc de code
# bm-cli tick reconfigure
Astuce

--dry is added to test the command: the operation is merely simulated

Bloc de code
# bm-cli tick reconfigure --dry

Operations on users

Deleting archived (suspended) domain users

Info
titleversion info

The "bm-cli user" command will be available from BlueMind 3.5.11.

Commands can be coupled to perform several operations at once.

E.g. the command below is used to look for the email addresses of suspended users:

Bloc de code
bm-cli user get domain.net --archived --display "email"

You can then couple this command's return with a "delete" command to remove all the users it returns:

Bloc de code
bm-cli user get local.lan --display "email" | jq -r '.[].email' > /tmp/archived.txt
while read account; do bm-cli user delete --dry $account ;done < /tmp/archived.txt

Operations on calendars

Sharing all user calendars with one user

It may be useful for one user to have access privileges on all user calendars without being given an administrator role (e.g. a secretary might be able to view/create events for all other employees). To avoid having to go through each user's page to enable sharing, this can be done in command line.

This cannot be done with a single command, but you can create a loop which picks up all domain users and enables sharing for each of them:

Bloc de code
bm-cli users get domain.net > /tmp/allUser.domain.net
while read account; do bm-cli calendar share $account « default » toto@domain.net r;done < /tmp/allUser.domain.net

Operations on contacts

The procedure below can be used to clean a user's collected address book and transfer their contacts to their personal address book (and testing the import process beforehand):

Bloc de code
root@mail:~# bm-cli contact list jdoe@bluemind.loc
{"owner":"05E25C2C-3643-4ED2-997C-4A4F39933D18","uid":"book:Contacts_05E25C2C-3643-4ED2-997C-4A4F39933D18","name":"My contacts"}
{"owner":"05E25C2C-3643-4ED2-997C-4A4F39933D18","uid":"book:CollectedContacts_05E25C2C-3643-4ED2-997C-4A4F39933D18","name":"Collected contacts"}
{"owner":"05E25C2C-3643-4ED2-997C-4A4F39933D18","uid":"408C741B-3FDC-44B6-B1FD-19E79404BFCF","name":"Perso"}
root@mail:~# bm-cli contact deduplicate jdoe@bluemind.loc --addressbook-uid book:CollectedContacts_05E25C2C-3643-4ED2-997C-4A4F39933D18
2 were removed out of 35
root@mail:~# bm-cli contact export jdoe@bluemind.loc --vcf-file-path /tmp/jdoe-collected.vcf --addressbook-uid book:CollectedContacts_05E25C2C-3643-4ED2-997C-4A4F39933D18
addressbook book:CollectedContacts_05E25C2C-3643-4ED2-997C-4A4F39933D18 of jdoe@bluemind.loc was exported
root@mail:~# bm-cli contact import jdoe@bluemind.loc --vcf-file-path /tmp/jdoe-collected.vcf --addressbook-uid 408C741B-3FDC-44B6-B1FD-19E79404BFCF --dry
DRY : AddressBook 408C741B-3FDC-44B6-B1FD-19E79404BFCF of jdoe@bluemind.loc was imported
root@mail:~# bm-cli contact import jdoe@bluemind.loc --vcf-file-path /tmp/jdoe-collected.vcf --addressbook-uid 408C741B-3FDC-44B6-B1FD-19E79404BFCF
AddressBook 408C741B-3FDC-44B6-B1FD-19E79404BFCF of jdoe@bluemind.loc was imported
root@mail:~# bm-cli contact reset jdoe@bluemind.loc --addressbook-uid book:CollectedContacts_05E25C2C-3643-4ED2-997C-4A4F39933D18
Addressbook book:CollectedContacts_05E25C2C-3643-4ED2-997C-4A4F39933D18 of jdoe@bluemind.loc was reset