Ma_Sys.ma Emergency Remote Control

Name

maerct – Ma_Sys.ma Emergency Remote Control: Kill X11 in case of hangs.

Synopsis

maerct [-f] FILE

Description

This program has to be run by the root user. It takes a Linux keyboard event device, e. g. /dev/input/event0 and grabs it exclusively. Do not run it if you only have one keyboard attached. -f forks twice.

NumLock CapsLock ScrollLock Description
slow off off Program operating correctly.
fast off off Program expecting input.
off fast off Process X takes >80% CPU.
off slow off RAM exceeded.
off off slow Shorttime Load AVG greater 10.
off off fast Command is being executed.
off off off Program not operating.

Table of possible inputs

Key Description
ESC Cancel pending operation
F1 Attempt to kill X11 process
F2 Attempt to start (and immediately terminate) new X server.
F4 Exit this program (no unlock required)
u Press this before another operation to unlock input.

Extended Description

This program is intended to run as a background service on an interactively used machine with a second keyboard connected for the sole purpose of being used by this program (e. g. one can install otherwise unused PS2 keyboards for the purpose).

It then outputs a limited amount of status information in form of regular blink codes using the three keyboard LEDs: NumLock, CapsLock and ScrollLock.

Apart from displaying status, it can serve as a remote control (thus the name) for killing the X-server. This might be an interesting feature for users of third-party kernel modules (e. g. NVidia drivers or VirtualBox modules) which used to cause some X11 freezes on the machine this program was developed for. By pressing [U], followed by [F1], one can cause the X-server to be terminated, freeing access to the console (if it does not work, sequence [U] followed by [F2] attempts to restart the X-server).

Be aware that similar to SysRq-codes (which may also work in such cases), this program allows bypassing any running screensaver! In case you only want the keyboard blinking, consider using ma_capsblinker(11) (currently does not provide any status information, but does not need to run on a separate keyboard).

This program is provided together with an LSB init script (masysma-emergency-remote-control) and a default configuration in /etc/default/maerct which is actually a shellscript sourced into the init script, allowing for host-specific configuration or any other logic.

Compilation

To compile this program, a C compiler is needed e. g. as provided by Debian package gcc-8-base. Additionally, the ant build tool is needed and can then be invoked by running ant. To build the Debian package (with the necessary dependencies installed), use ant package.


Ma_Sys.ma Website 5 (1.0.2) – no Flash, no JavaScript, no Webfont, no Copy Protection, no Mobile First. No bullshit. No GUI needed. Works with any browser.

Created: 2020/01/17 15:22:37 | Revised: 2022/09/18 21:18:14 | Tags: programs, c, maerct, linux, keyboard | Version: 1.1.0 | SRC (Pandoc MD) | GPL

Copyright (c) 2020 Ma_Sys.ma. For further info send an e-mail to Ma_Sys.ma@web.de.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.