Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pschmitt/tmux-slay
TMUX script to run commands in a background session. Similar to abduco/dtach.
https://github.com/pschmitt/tmux-slay
abduco background-jobs bash dtach init-system screen slay tmux
Last synced: 18 days ago
JSON representation
TMUX script to run commands in a background session. Similar to abduco/dtach.
- Host: GitHub
- URL: https://github.com/pschmitt/tmux-slay
- Owner: pschmitt
- License: gpl-3.0
- Created: 2020-06-05T11:11:23.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-05-09T12:14:35.000Z (6 months ago)
- Last Synced: 2024-10-13T02:10:16.180Z (about 1 month ago)
- Topics: abduco, background-jobs, bash, dtach, init-system, screen, slay, tmux
- Language: Shell
- Size: 69.3 KB
- Stars: 23
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ฌ tmux-slay
This scripts allows running commands in the background, in a TMUX session.
It can be a poor man's init-sytem.
# ๐ Dependencies
bash, awk, sed and tmux ๐คท
# ๐จ Installation
## ๐ง Using zinit
```zsh
zinit light-mode wait lucid as"null" \
sbin"tmux-slay" \
atload"alias tslay=tmux-slay" \
for @pschmitt/tmux-slay
```## ๐ฆ Otherwise
Just get `tmux-slay` and put it in your PATH.
# ๐ผ Completions
Completions for ZSH are available in the `completions/` dir.
# ๐ฎ Usage
```bash
# Run single command
tmux-slay run COMMAND# List running commands
tmux-slay list# Display and follow log
tmux-slay logs -f COMMAND# Stop/kill it
tmux-slay kill COMMAND# Run command in a loop (repeatedly)
tmux-slay run -l COMMAND# Run command once (don't start a second instance if it is already running)
tmux-slay run -c COMMAND# Spawn a new instance of COMMAND and kill other windows running the same command
tmux-slay run -u COMMAND# Clear all. Kill all running commands
tmux-slay killall# Focus on output window running command
tmux-slay select COMMAND
```# โ๏ธ Configuration
## ๐ถ Session name
By default `tmux-slay` will create a new TMUX session named `bg` (for
backgroud) to run all the commands you instruct it to.To change that you can set the env var `TMUX_SLAY_SESSION`:
```bash
TMUX_SLAY_SESSION="MY_SESSION_NAME"
```## ๐ Init window
`tmux-slay` keeps its session alive by creating an empty init-window named
`bg-init`.To change it you need to set `TMUX_SLAY_INIT_WINDOW_TITLE`:
```bash
TMUX_SLAY_INIT_WINDOW_TITLE="MY_INIT_WINDOW_TITLE"
```## ๐ Debug mode
To debug `tmux-slay` just set `TMUX_SLAY_DEBUG` to any value:
```bash
TMUX_SLAY_DEBUG=1
```To debug commands started with `tmux-slay` the best thing to do is to enable the
`remain-on-exit` options for the session, so that you don't loose the logs of
your command:```bash
tmux-slay debug on
```To disable this again, run:
```bash
tmux-slay debug off
```# ๐งช Examples
## ๐ป Run an auto-reconnecting reverse SSH tunnel to the current machine
```bash
tmux-slay run -l -c -u -n ssh-forward -- \
ssh -o ExitOnForwardFailure=yes -R 22222:localhost:22 [email protected]
```