reorganized folder structure authored by tem_invictus's avatar tem_invictus
# Command Line Options
OSCam supports various command-line parameters to configure its behavior at startup.
## Usage
```
oscam [parameters]
```
## Directories
| Option | Description |
|--------|-------------|
| `-c, --config-dir <dir>` | Read configuration files from `<dir>`.<br>Default: `/usr/local/etc` |
| `-t, --temp-dir <dir>` | Set temporary directory to `<dir>`.<br>Default: `/tmp/.oscam` (Linux/macOS) or OS-TMP (Cygwin) |
## Startup
| Option | Description |
|--------|-------------|
| `-b, --daemon` | Start in the background as daemon.<br>(On STAPI/STAPI5 systems, use `-f` instead) |
| `-f, --foreground` | Start in the foreground mode.<br>(Only available on STAPI/STAPI5 systems) |
| `-B, --pidfile <pidfile>` | Create pidfile when starting. |
| `-r, --restart <level>` | Set restart level (requires WebIf):<br>`0` - Restart disabled (exit on restart request)<br>`1` - WebIf restart is active (default)<br>`2` - Like 1, but also restart on segfaults |
| `-w, --wait <secs>` | Set how many seconds to wait at startup for the system clock to be set correctly.<br>Default: `60` |
## Logging
| Option | Description |
|--------|-------------|
| `-I, --syslog-ident <ident>` | Set syslog ident.<br>Default: `oscam` |
| `-S, --show-sensitive` | Do not filter sensitive info (card serials, boxids) from the logs. |
| `-d, --debug <level>` | Set debug level mask used for logging (see [Debug Levels](#debug-levels) below).<br>Default: `0` (no extra debugging) |
### Debug Levels
Debug levels can be combined by adding their values together:
| Level | Description |
|-------|-------------|
| `0` | No extra debugging (default) |
| `1` | Detailed error messages |
| `2` | ATR parsing info, ECM, EMM and CW dumps |
| `4` | Traffic from/to the reader |
| `8` | Traffic from/to the clients |
| `16` | Traffic to the reader-device on IFD layer |
| `32` | Traffic to the reader-device on I/O layer |
| `64` | EMM logging |
| `128` | DVBAPI logging |
| `256` | Loadbalancer logging |
| `512` | CACHEEX logging |
| `1024` | Client ECM logging |
| `2048` | CSP logging |
| `4096` | CWC logging |
| `8192` | CW Cache logging (CS_CACHEEX_AIO only) |
| `65535` | Debug all |
**Example:** To enable detailed error messages (1) and ECM/EMM dumps (2), use `-d 3`
## Settings
| Option | Description |
|--------|-------------|
| `-p, --pending-ecm <num>` | Set the maximum number of pending ECM packets.<br>Default: `32`<br>Maximum: `4096` |
## Debug Parameters
These options are intended for development and troubleshooting:
| Option | Description |
|--------|-------------|
| `-a, --crash-dump` | Write `oscam.crash` file on segfault. This option requires GDB to be installed and OSCam executable to contain debug information (run `oscam-XXXX.debug`). |
| `-s, --capture-segfaults` | Capture segmentation faults. |
| `-g, --gcollect <mode>` | Garbage collector debug mode:<br>`1` - Immediate free<br>`2` - Check for double frees |
## Information
| Option | Description |
|--------|-------------|
| `-h, --help` | Show command line help text. |
| `-V, --build-info` | Show OSCam binary configuration and version. |
## Examples
Start OSCam in daemon mode with custom config directory:
```
oscam -b -c /etc/oscam
```
Start OSCam with debug logging for client traffic:
```
oscam -d 8
```
Start OSCam with custom temp directory and pidfile:
```
oscam -t /var/tmp/oscam -B /var/run/oscam.pid
```
Show build information:
```
oscam -V
```
Start with combined debug levels (errors + ECM dumps + client traffic):
```
oscam -d 11
```
## Notes
- Most options can be combined. For example: `oscam -b -c /etc/oscam -d 255`
- The `-r` restart option is only available when OSCam is compiled with WebIf support
- Debug levels are bitmasks and can be combined by adding their values
- Platform-specific: STAPI/STAPI5 systems use `-f` (foreground) instead of `-b` (daemon)