# Launcher

## Windows launcher

When installing the Trust1Connector you will have a launcher executable. This executable takes care of a couple of things;

* Starting the Trust1Connector
* Stopping the Trust1Connector
* Migration (makes sure file-exchange is kept between installation)

Below you can find an output of the flags and options that can be used;

{% code title="t1c-launch.exe" %}
```bash
USAGE:
    t1c-launch.exe [FLAGS] [OPTIONS]

FLAGS:
    -m, --migrate      Executes the migrate functionality which will cleanup the current installation
    -r, --restart      Restart the Trust1Connector
    -k, --skip-kill    Skips killing the processes upon start|restart|stop|migrate
    -s, --stop         Stop the running instance

OPTIONS:
        --env <prod>    Defines the environment where the Trust1Connector must run [possible values: dev, acc, prod]

```
{% endcode %}

### Start the Trust1Connector

To start the trust1connector you can execute the following, be aware that the command option depends on which environment you have installed. Below you can find in comments which environment will be triggered.

When the start command is executed the Trust1Connector will first stop the running instances before starting.

{% hint style="info" %}
Running the launcher as a different environment from which you have installed will not work
{% endhint %}

```bash
# production
t1c-launch.exe

# acceptance
t1c-launch.exe --env acc

# develop
t1c-launch.exe --env dev
```

### Stop the Trust1Connector

Similar like starting the Trust1Connector you can manually stop this. This is done via the `-s` flag

{% hint style="info" %}
Running the launcher as a different environment from which you have installed will not work
{% endhint %}

```bash
# production
t1c-launch.exe --stop

# acceptance
t1c-launch.exe --env acc --stop

# develop
t1c-launch.exe --env dev --stop
```

### Migration

Migration is a function that will make sure that some data is retained between installation, such as the file-exchange configuration.

This function is automatically executed when uninstalling the Trust1Connector.

{% hint style="danger" %}
We do not advise to run this on your own as this can impact the running installation
{% endhint %}

If you need to run this you can do the following commmands, here again it depends on the environment option

```bash
# production
t1c-launch.exe --migrate

# acceptance
t1c-launch.exe --env acc --migrate

# develop
t1c-launch.exe --env dev --migrate
```

## MacOS launcher

When installing the Trust1Connector you will have a launcher executable. This executable takes care of a couple of things;

* Starting the Trust1Connector
* Stopping the Trust1Connector
* Migration (makes sure file-exchange is kept between installation)

MacOS launcher has the same functionality but works differently in the background. It will use `launchd` to start/run the Connector.

Below you can find an output of the flags and options that can be used;

{% code title="t1c-launch.exe" %}
```bash
USAGE:
    t1c-launch [FLAGS] [OPTIONS]

FLAGS:
    -m, --migrate      Executes the migrate functionality which will cleanup the current installation
    -r, --restart      Restart the Trust1Connector
    -k, --skip-kill    Skips killing the processes upon start|restart|stop|migrate
    -s, --stop         Stop the running instance

OPTIONS:
        --env <prod>    Defines the environment where the Trust1Connector must run [possible values: dev, acc, prod]
```
{% endcode %}



### Start the Trust1Connector

To start the trust1connector you can execute the following, be aware that the command option depends on which environment you have installed. Below you can find in comments which environment will be triggered.

When the start command is executed the Trust1Connector will first stop the running instances before starting.

{% hint style="info" %}
Running the launcher as a different environment from which you have installed will not work
{% endhint %}

```bash
# production
./t1c-launch

# acceptance
./t1c-launch --env acc

# develop
./t1c-launch --env dev
```

### Stop the Trust1Connector

Similar like starting the Trust1Connector you can manually stop this. This is done via the `-s` flag

{% hint style="info" %}
Running the launcher as a different environment from which you have installed will not work
{% endhint %}

```bash
# production
./t1c-launch --stop

# acceptance
./t1c-launch --env acc --stop

# develop
./t1c-launch --env dev --stop
```

### Migration

Migration is a function that will make sure that some data is retained between installation, such as the file-exchange configuration.

This function is automatically executed when uninstalling the Trust1Connector.

{% hint style="danger" %}
We do not advise to run this on your own as this can impact the running installation
{% endhint %}

If you need to run this you can do the following commmands, here again it depends on the environment option

```bash
# production
./t1c-launch --migrate

# acceptance
./t1c-launch --env acc --migrate

# develop
./t1c-launch --env dev --migrate
```

### Check if the Trust1Connector is running via launchd

If you want to check if the launchd API is running you can do the following;

```bash
# list the launchd instances and then grep the t1t
launchctl list | grep t1t

# The following should have a similar output, the 2nd number will be a different number when the Trust1Connector is not starting correctly
    64832	0	com.t1t.t1c.api
```

The output will have 3 parameters;

1. PID of the running instance, **will be 0 if not running**
2. Error code of the instance, **will be 0 if none**
3. name of the launchd program

If you have an error code and the PID is 0, please contact support.

{% hint style="info" %}
An error code can occur and will remain visible in the launchctl command. As long as the instance has a valid PID it means the Trust1Connector is running as expected.

That error code can indicate a crash from the past.
{% endhint %}
