https://github.com/alextmjugador/ttyrun
Runs a command in the first TTY device a user logged in, just like if the user typed it. In the background, it inserts simulated keypresses using the TIOCSTI ioctl.
https://github.com/alextmjugador/ttyrun
administration linux-script tty
Last synced: 3 months ago
JSON representation
Runs a command in the first TTY device a user logged in, just like if the user typed it. In the background, it inserts simulated keypresses using the TIOCSTI ioctl.
- Host: GitHub
- URL: https://github.com/alextmjugador/ttyrun
- Owner: AlexTMjugador
- License: gpl-3.0
- Created: 2019-08-03T15:12:03.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-03T15:29:02.000Z (over 6 years ago)
- Last Synced: 2025-01-26T01:41:29.843Z (12 months ago)
- Topics: administration, linux-script, tty
- Language: Shell
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ttyrun
Runs a command in the first TTY device a user logged in, just like if the user typed it. In the background, it inserts simulated keypresses using the TIOCSTI ioctl.
### Usage
By default, ttyrun is located in /usr/bin/ttyrun, and is executable by every user (although normally only root has the necessary permissions to write to a TTY device). When it is launched, ttyrun uses the output of the who command to look for the first user logged in to a TTY, and executes a specified command on it if it finds any. ttyrun accepts two command line arguments to customize this behavior:
* _-c command_: specifies the command to run on the TTY. This is passed as an argument to a `/bin/sh -c` call.
* _-u user_: finds the first TTY that _user_ logged in to, and uses that. If not specified, ttyrun will use the first TTY any user logged in to.
### Building and packaging
This program is only composed of shell scripts, so no compilation is necessary. It should work in any GNU/Linux box that has a POSIX shell and the needed dependencies.
However, it is distributed as a .deb package that is generated with a Makefile. To create the ttyrun .deb package, you only need to make changes to the installed files, and then run:
```console
$ make
```
# Installation
You can get the official .deb package from the [releases page](https://github.com/AlexTMjugador/ttyrun/releases). Installing the package is pretty straightforward:
```console
# dpkg -i ttyrun_1.0-1.deb
```
If dpkg complains about missing dependencies, make sure you install them first.