create-service Scripts

Overview

During the installation of EnterWorks 10.3 or later, a set of scripts is created that make it easier for you to later change the configuration options for services as needed and re-register the services. There is one for each microservice and they are named create-enable-<service-name>-service.cmd, (or create-enable2020-<service-name>-service.cmd).

In the event that a service needs to be reconfigured, edit its create-service script to set the desired options, then run the script as an administrator. It will stop the service, delete the service, then recreate the service, using the parameters defined in the script. If your EnterWorks system uses a network service account, after you run the script, you will need to set the service's Log On properties as described in Use a create-service Script.

Fresh installations of EnterWorks 10.3 or later automatically generate the create-scripts. If you are running a version of EnterWorks earlier than 10.3, you may have to create the scripts manually.

The create-service script for a miroservice is located on the VM hosting the microservice, in:

<install drive>:\Enterworks\enable2020\services\install

To list a microservice's parameters, run the executable with the -h option as shown in the example below.

<install-drive>:\EnterWorks\enable2020\services\bin\<service-name>.exe -h

Create a create-service Script

The following is an example of a create-service script. (Note that <hostname> would be replaced with the actual host name.)

NET STOP enable-web-server-service
sc delete enable-web-server-service
sc create enable-web-server-service binpath=^"D:\Enterworks\enable2020\services\bin\enable2020-web-server-service.exe ^
-rabbitServer=enable2020:enable2020@<hostname> ^
-epimHost=<hostname>:8090 ^
-port=80 ^
-cliBuildFolder=D:\Enterworks\enable2020\enable2020 ^
-uploadFolder=D:\Enterworks\enable2020\services\uploads ^
-epxHost=<hostname> ^
-sessionDbFile=D:\Enterworks\enable2020\sessions\enable2020-session.db ^
-loggingLevel=INFO ^
-logDir=D:\Enterworks\logs\enable2020 ^
-exchange=enable2020 ^
-esBrokerQueue=elasticSearchBroker ^
-webcmBrokerQueue=webcmBrokered ^
-enableDamQueue=enableDam ^
-enableApiQueue=enableApi ^
-channelReadinessQueue=enableChannelReadiness ^
-epxBrokerQueue=epxBrokerQueue ^
-disableAdmin=false ^
-disableReport=false ^
-disableSystem=false"

To create a create-script:

  1. In Notepad++ or another editor, create an empty .cmd or .bat file with the appropriate create-script name. Open the Services window to find the name of the service. Note that depending on how your EnterWorks system was installed, your services may be named enable-<service-name>-service.cmd or enable2020-<service-name>-service.cmd.
  2. Copy the lines below into your new file.
    NET STOP enable-<service-name>-service
    sc delete enable-<service-name>-service
    sc create enable-<service-name>-service binpath=^"
    "
    Warning: Note that all double quotes in the file must be the ASCII straight double quote, not a beginning or ending quote you type in from the keyboard. When you need to insert a double quote, the easiest way to ensure you are inserting the correct double quote is to copy it from someplace else in the file.
  3. In the first three lines, change the name of the service to match the actual name of the service. The following is an example.
  4. Open the Services window, right-click the desired service, and select Properties. The Properties window will appear.
  5. Drag-select the entire Path to executable string. It may be quite long so make sure you get it all.
  6. Paste the entire string into the new file, after the binpath=^" Your file will now look like the below. Note that your settings may be different than the one shown below.
  7. Enter the line breaks. Replace all - with ^\n-. There is a space before the - and before the ^. Set the Search Mode to Extended.
  8. Each setting in your file should now be on a separate line. On the last line in the file, remove the line break before the " so that the " moves to the end of the previous line.
  9. With the exception of the double quote in binpath=^" and the final double quote on the last line, add the escape character \ directly before all other double quotes appearing in the file. For example:
    -cliBuildFolder="D:\Enterworks\enable2020\enable2020" ^
    would become:
    -cliBuildFolder=\"D:\Enterworks\enable2020\enable2020\" ^
  10. Save the file.

Use a create-service Script

Note that create scripts can be either .cmd or .bat files.

After you edit a create script, in order for the script to take effect, you must:

  1. Right-click the create script and run it as an administrator.
  2. If your EnterWorks system uses a network service account, you must set its Log On properties:
    1. Open the Services window, right-click the desired service, and select Properties. The Properties window will appear.
    2. Open the Log On tab.
    3. Select This account and enter the network service account's name and password.
    4. Click Apply.

In order for the settings in the create script to take effect, you must restart the service. Depending on the procedure you are following, you may not want to do restart the service at this time.