Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Windows batch script files #130

Closed
licsofin opened this issue Aug 9, 2020 · 0 comments · Fixed by #290
Closed

Updated Windows batch script files #130

licsofin opened this issue Aug 9, 2020 · 0 comments · Fixed by #290
Assignees
Milestone

Comments

@licsofin
Copy link

licsofin commented Aug 9, 2020

Hi.

I have been using LSC since late 2015 in a task for populating an Active Directory Domain Services directory (Windows Server 2016/2019) from an OpenLDAP one (running on Linux distributions). At first it was difficult, because I had to understand how LSC worked and the task had to be run on the Windows side. Back then, I found that the batch files provided in the LSC download had errors when I wanted to use them, forcing me to check out and make some very superficial corrections.

A few months ago, our attribute settings in OpenLDAP changed and LSC stopped working properly, forcing me to recheck the online documentation. Having to work with the configuration files "lsc.xml" and "logback.xml" (and having a little more time available) I also checked the files "lsc.bat" and "lsc-agent.bat", and decided to write a new version of the scripts for Windows that I would like you to review and, if deemed appropriate, add to the LSC download to replace the 2 mentioned ".bat" files, as well as a configuration file suitable for Windows.

The improvements and fixes are as follows:

  • Complete rewriting of the code, based on both Windows and Linux scripts.
  • Change the file extension ".bat" to ".cmd" to ensure that the script is processed by the "cmd.exe" shell (present in systems with "NT" kernel, for example Windows 2000, XP and later) and not by "COMMAND.COM" (the shell of "MS-DOS" kernel systems, such as Windows ME and earlier, which is also present on 32-bit versions of "NT" systems).
  • Change the text encoding of the files, from "UTF-8" to "ANSI", which is the set supported without problems by the command interpreter.
  • Correction of the search of the Java executable in the environment variable "PATH". In addition, the search in the variables "ProgramFiles" and "ProgramFiles (x86)" was added, so, together with the search in the variable "JAVA_HOME" (first variable to be checked), there are now 4 search places.
  • Use of default path to configuration file "lsc.xml" if "-f" option is not specified.
  • Creation and use of the "logs" folder inside the main LSC directory to save log files instead of the "Temp" folder, which is more hidden and susceptible to file deletions by cleaning programs.
  • The logs now show the complete time and date.
  • More detailed event logs of the execution of both scripts.
  • Recording of the exact error code, if present, of the executed Java command, and not only the generic ones 1 and 2.
  • Change of saving paths from log files to the mentioned "logs" folder in the "log.xml" file, and adaptation of the LSC event log strings so that they are saved in the "lsc.log" file and match more with those of Windows scripts.

In addition to these files, I also attach a sample "lsc.xml" file for create / update objects and updating passwords in only one task, that approximately lasts 1:30 hr for about 70,000 objects synced; before it, I used 2 tasks (as suggested by @coudot to me in http://lists.lsc-project.org/pipermail/lsc-users/2016-January/002824.html), but their execution for the same number of users was of 2:30 hr, so I needed to readapt they into only one.

New Windows batch script files and config XML files.zip

@coudot coudot self-assigned this Jul 15, 2021
@coudot coudot added this to the 2.2 milestone Jul 15, 2021
@coudot coudot linked a pull request May 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants