# Fieldbus Access runtime

## Service management

Fieldbus Access runs as a service and the management is different depending on
the system it runs on.

### CC Linux 4

The runtime starts as a service and can be controlled by `systemctl`. Use either
`enable` or `disable` to control if Fieldbus Access should autostart or not:

``` console
sudo systemctl enable fieldbusaccess
sudo systemctl disable fieldbusaccess
```

The service may also be started or stopped while the system is running:

``` console
sudo systemctl start fieldbusaccess
sudo systemctl stop fieldbusaccess
```

Output from the service can be checked with `journalctl`:

``` console
sudo journalctl -fu fieldbusaccess
```

## Startup arguments

```console
$/appfs/bin/fieldbusaccess --help
Usage: ./fieldbusaccess [options] config
Transfer configured signals between CAN-bus and Application through Data Engine

Options:
  -h, --help          Displays help on commandline options.
  -v, --version       Displays version information.
  --name <Name>       Instance name of FA to use [Default: FieldbusAccess]
  -d, --debug <level> Additional debug output. Select level: 1=Debug,
                      2=Warning, 3=Critical, 4=Fatal.
  -ip <ip-address>    IP Address to DE [Default: 127.0.0.1]

Arguments:
  config              Path and name of configuration file to use.
```

### -h, --help

Display the help information.

### -v, --version

Display version information about Fieldbus Access.

### --name \<Name>

Instance name of Fieldbus Access. Default if none is selected, 'fieldbusAccess'

### -d, --debug \<level>

Activate additional printouts during execution. Number selects level to print to
file. Logfiles are found on the device at
`/data/home/ccs/FieldbusAccess/logs/debug_log.txt` and 
`/opt/FieldbusAccess/logs/debug_log.txt` on the vm. Argument level and higher will be
added to the log. If you add `-d 2 (Warning)` as argument, Warnings, Critical
and Fatal errors will be added to the logfile.

Level | Error    | Description
------|----------|-------------------------------------------------------------------------------------------------
1     | Debug    | Information that is diagnostically helpful
2     | Warning  | Anything that can potentially cause runtime oddities but are automatically recovering
3     | Critical | Any error which is critical to the operation. These errors will usually force user  intervention
4     | Fatal    | Any error that is forcing a shutdown of the runtime

### -ip \<ip-address>

IP Address to connect to Data Engine. Default is 'localhost' 127.0.0.1.

### config

Nonoptional argument. Configuration file (.json) created by LinX Manager
Fieldbus Access

## Example

```console
fieldbusaccess [options] configuration
$/appfs/bin/fieldbusaccess --debug 2 FieldbusAccess_ConfigFile.json
Will add `Warning, Critical and Fatal` messages in /data/home/ccs/FieldbusAccess/logs/debug_log.txt
```
