# logoff command

The logoff BASIC program terminates
a process on a given port and sends the port to the logon prompt.

The logoff process first attempts a normal log off by
simulating a break and off sequence on the target port. If that times
out, logoff escalates and forces the process into the debugger and
simulates an off. If that fails, the target port is reinitialized,
without attempting to clean up or recover its workspace.

The *phantom* ports (that is, the scheduler, transaction logger, and
those *hung* ports) may now be properly logged off.

Note: It is not recommended to log off the transaction logger before entering stoplog.

Process locks are released during a logoff and the tapes are detached. The errors file contains a history of logoffs.

## Syntax

```
logoff {port.number}{(options}
```

## Parameter(s)

| port.number | Specifies the port number to be set. If not specified, the port number is requested. | |
| --- | --- | --- |
| options | e | (Echo) Displays selected messages even if capturing is on. |
| f | Allows logging off the same port from two different lines simultaneously. | |
| k | Kills a shell if the process is shelled out. | |
| x | Kills the underlying UNIX pid or Windows thread. | |
Warning: Logging off a port should be treated as a last resort. It should be used by a
 system administrator only when the status of the PIB and potential problems that could arise
 have been assessed.

## Example(s)

```
logoff
line: 677
[534] logoff successful.
```

```
logoff 677
[534] logoff successful.
```

## See also

- [:background-stop command](https://d3codex.com/backgroundphantomprocess/colon-background-stop-command/)
- [admin utility](https://d3codex.com/tcl/admin-utility/)
- [check-ws command](https://d3codex.com/tcl/check-ws-command/)
- [end command (TCL commands)](https://d3codex.com/tcl/end-command-tcl-commands/)
- [exit command](https://d3codex.com/tcl/exit-command/)
- [Hung port](https://d3codex.com/definitions/hung-port/)
- [list-logoffs command](https://d3codex.com/tcl/list-logoffs-command/)
- [logon command](https://d3codex.com/tcl/logon-command/)
- [off command (TCL commands)](https://d3codex.com/tcl/off-command-tcl-commands/)
- [Port number](https://d3codex.com/definitions/port-number/)
- [power-off command](https://d3codex.com/tcl/power-off-command/)
- [reset-user command](https://d3codex.com/tcl/reset-user-command/)
- [System privileges](https://d3codex.com/definitions/system-privileges/)
- [u0032 user exit](https://d3codex.com/proc/u0032-user-exit/)
- [ua116 user exit](https://d3codex.com/pickbasic-flashbasic/ua116-user-exit/)

---
Source: https://d3codex.com/tcl/logoff-command/ - part of the D3Codex reference.
