You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2022-05-05 14:51:01

Afol
Member
Registered: 2021-12-23
Posts: 77

Automation of user import and synchronization

Hello,
I have configured GLPI for LDAP connection with Active Directory and it has always worked.
But I would now like to make a scheduled option to automatically synchronize user import and synchronization of existing users.
Currently I do it manually but it is inconvenient, I would like it to do it automatically every time I say so.

Thank you!

Offline

#2 2022-05-05 15:05:36

LaDenrée
HELPER
Registered: 2012-11-19
Posts: 6,287

Re: Automation of user import and synchronization

read this :
https://glpi-install.readthedocs.io/en/ … honization

then insert bin/console glpi:ldap:synchronize_users  + options in your crontab (or scheduled task)


Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1  Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9

Offline

#3 2022-05-06 09:29:46

Afol
Member
Registered: 2021-12-23
Posts: 77

Re: Automation of user import and synchronization

but do you intend to add a scheduled task directly from glpi? because if I go to the section, the plus symbol to add a new one is disabled.

Offline

#4 2022-05-06 14:09:23

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,813
Website

Re: Automation of user import and synchronization

The add button for Automatic Actions is always disabled because there is no way to add your own custom action. It is only visible as a byproduct of how different item types are composed and displayed in the back-end of GLPI in 9.5 and older. In GLPI 10, the add button shouldn't be visible at all.

You must use your system's cron (Unix-based) or Task Scheduler (Windows) for this auto import/sync.


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#5 2022-05-06 14:25:38

Afol
Member
Registered: 2021-12-23
Posts: 77

Re: Automation of user import and synchronization

cconard96 wrote:

The add button for Automatic Actions is always disabled because there is no way to add your own custom action. It is only visible as a byproduct of how different item types are composed and displayed in the back-end of GLPI in 9.5 and older. In GLPI 10, the add button shouldn't be visible at all.

You must use your system's cron (Unix-based) or Task Scheduler (Windows) for this auto import/sync.

ah, I understand.
How do I do from the command line (I have linux) to schedule the automatic update every day at 7pm?

i try the command:
php bin/console
bin/console glpi:ldap:synchronize_users - u     (for synchronize existing users)
bin/console glpi:ldap:synchronize_users -c       (for import new users)

they work.

i create a script .sh:

#!/usr/bin/php
../../bin/console glpi:ldap:synchronize_users -u 
../../bin/console glpi:ldap:synchronize_users -c

but you can't run two commands together. do i have to make two script files? for now I have created two separate scripts.

i edited the crontab
EDITOR=nano crontab -e

I wrote this on the crontab, is it correct? the first is performed at 2 am. the second at 3

0 2 * * * root /var/www/html/glpi/scripts/ScriptMarco/aggiorna_utenti.sh
0 3 * * * root /var/www/html/glpi/scripts/ScriptMarco/importa_utenti.sh

Last edited by Afol (2022-05-09 09:25:27)

Offline

#6 2022-05-10 14:27:35

Afol
Member
Registered: 2021-12-23
Posts: 77

Re: Automation of user import and synchronization

not work..

Offline

#7 2022-05-10 16:31:52

Afol
Member
Registered: 2021-12-23
Posts: 77

Re: Automation of user import and synchronization

0 8 * * * cd /var/www/glpi/scripts && php -q -f ldap_mass_sync.php -- action=1 server_id=1
0 8 * * * cd /var/www/glpi/scripts && php -q -f ldap_mass_sync.php -- action=0 server_id=1

First line for synchronize existing users
second for import new users in LDAP

For the 8 AM it's just an exemple
thank you!

Offline

#8 2023-06-09 09:19:37

LaDenrée
HELPER
Registered: 2012-11-19
Posts: 6,287

Re: Automation of user import and synchronization

LaDenrée wrote:

read this :
https://glpi-install.readthedocs.io/en/ … honization

then insert bin/console glpi:ldap:synchronize_users  + options in your crontab (or scheduled task)


Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1  Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9

Offline

Board footer

Powered by FluxBB