How to sync LDAP users using command line like "php artisan snipeit:ldap-sync" command line?
Hi, I am getting an error like "Could not open input file: artisan" when I sync LDAP users from AD into Snipe-IT using CLI (php artisan snipeit:ldap-sync). But I can sync LDAP with no error using GUI and the LDAP function works fine.
Please provide answers to these questions before posting your bug report:
- Version of Snipe-IT you're running - 3.6.3
- What OS and web server you're running Snipe-IT on - Ubuntu 14.04 and Apache2
- What method you used to install Snipe-IT (install.sh, manual installation, docker, etc) - install.sh
- WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error
- What specific Snipe-IT page you're on, and what specific element you're interacting with to trigger the error
- If a stacktrace is provided in the error, include that too.
- Any errors that appear in your browser's error console.
- Confirm whether the error is reproduceable on the demo.
- Include any additional information you can find in
app/storage/logsand your webserver's logs. - Include what you've done so far in the installation, and if you got any error messages along the way.
- Indicate whether or not you've manually edited any data directly in the database
What is the directory where your snipe-it install lives, and what directory are you running the artisan command from?
Hi, I got your point:-), Thank you snipe. Now I can run the artisan command from the snipe-it directory (admin@ams:/var/www/snipeit$ php artisan snipeit:ldap-sync) and it's working good. How can I create a php script file with command ''artisan snipeit:ldap-sync" ?. I need to set up a cron to automatically sync LDAP.
This is useful. I will need to look into this further.
For the cronjob you can probably use the following based on the path you provided above. 0 0 * * * /usr/bin/php /var/www/snipeit/artisan snipeit:ldap-sync >> /dev/null 2>&1
@itims yeah, you wouldn't want to write a PHP script to call that command, since it's already a command line script. It would just be an extra layer that doesn't actually do anything. The cron command @tiagom62 stated above should do the trick.
I know this is an old thread, but is this expected to work with Docker?
As running the commands individually inside the container work fine of course, but placing anything in any of the cron (cron.d, cron.daily, cron.weekly) folders do not seem to work.
I know this is an old thread, but is this expected to work with Docker?
As running the commands individually inside the container work fine of course, but placing anything in any of the cron (cron.d, cron.daily, cron.weekly) folders do not seem to work.
What command are you running inside the container to do an ldap sync manually? I'm not able to get this working.
Did you figure it out?
@SonGokussj4 & @SpartacusIam we setup a custom cronjob and volume mounted it that would trigger the sync.
I don't have the command/script anymore (I no longer work there). But given that this is 4 years old, I am not sure it would still in fact work.
I would recommend you look at the SCIM functionality that was just released instead.
[ SOLVED ] Finally solved here with a cronjob to make it automatical too: #8475