Skip to content

Running ImportClient

Manually

In its simplest form, ImportClient can be executed like this:

1
& PathTo/java.exe -Xmx512m -jar PathTo/import-client-xxxx.x.x.jar PathTo/settingsFile.txt
1
PathTo/java.exe -Xmx512m -jar PathTo/import-client-xxxx.x.x.jar PathTo/settingsFile.txt
1
exec PathTo\java -Xmx512m -jar PathTo\import-client-xxxx.x.x.jar PathTo\settingsFile.txt

This will start ImportClient (import-client-xxxx.x.x.jar) with a memory allocation (Xmx) of 512 Mb and a settings file (settingsFile.txt). This is especially useful when troubleshooting or testing a configuration before adding it to a scheduled task / job.

This command is often written in a run.cmd or run.sh that is then used in a scheduled task or job in cron. ImportClient does not in itself handle any scheduling.

Scheduled

This is a basic example of how a script file used to run ImportClient as a scheduled task / job can look like.

1
2
3
4
5
6
7
8
$javaExec = "PathTo\java.exe"
$client = "PathTo\import-client-xxxx.x.x.jar"
$configFile = 'PathTo\settingsFile.txt'
try {
    & $javaExec -Xmx512m -jar $client $configFile
} catch {
    throw $_
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
@echo off
SETLOCAL
Title Easit ImportClient
cd /d "%~dp0"

set client=import-client-xxxx.x.x.jar
set java=jre\bin\java.exe

"%java%" -Xmx512m -jar %client% settingsFile.txt

:end
set client=
set java=
1
2
3
4
5
#! /bin/bash

client=import-client-xxxx.x.x.jar
java=jre\bin\java.exe
exec $java -Xmx512m -jar $client settingsFile.txt

Windows Scheduled Task template

Feel free to save this example to a XML file and then import it to Windows Task Scheduler. If you do so, you need to replace the string ${ImportClientRoot} in Command and WorkingDirectory with the full path to the folder where you script and ImportClient client lives.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2022-12-14T11:19:03.5209452</Date>
    <Author>Easit</Author>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <StartBoundary>2022-12-14T06:00:00</StartBoundary>
      <Enabled>false</Enabled>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>S-1-5-19</UserId>
      <RunLevel>LeastPrivilege</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>false</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>false</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
    <UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>P1D</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>${ImportClientRoot}\run.cmd</Command>
      <WorkingDirectory>${ImportClientRoot}</WorkingDirectory>
    </Exec>
  </Actions>
</Task>

Considerations

Consideration - Memory usage

Depending in the amount of data collected from the source you might need to increase the value for Xmx. There is no easy way to know how much memory is needed by ImportClient as is depends on how mush data each item collected has and how many items are collected.