diff options
author | Aaron Ball <nullspoon@oper.io> | 2021-01-20 19:13:52 -0700 |
---|---|---|
committer | Aaron Ball <nullspoon@oper.io> | 2021-01-20 19:13:52 -0700 |
commit | 882c25fcee8c6f8c4420a137fa2301c455c638fd (patch) | |
tree | c56688c482a430e831393f9c7e21147e9bd35e72 | |
parent | f42b0793826d562d9c98f2f1c26ba7e475d61b00 (diff) | |
download | oper.io-882c25fcee8c6f8c4420a137fa2301c455c638fd.tar.gz oper.io-882c25fcee8c6f8c4420a137fa2301c455c638fd.tar.xz |
Convert linux manual restart with sysrq from adoc to rst
-rw-r--r-- | posts/linux:manual_restart_with_sysrq-trigger.rst (renamed from posts/linux:manual_restart_with_sysrq-trigger.adoc) | 76 |
1 files changed, 36 insertions, 40 deletions
diff --git a/posts/linux:manual_restart_with_sysrq-trigger.adoc b/posts/linux:manual_restart_with_sysrq-trigger.rst index 38a54eb..6923536 100644 --- a/posts/linux:manual_restart_with_sysrq-trigger.adoc +++ b/posts/linux:manual_restart_with_sysrq-trigger.rst @@ -1,10 +1,5 @@ Linux:Manual Restart with sysrq-trigger ======================================= -:author: Aaron Ball -:email: nullspoon@oper.io -:revdate: February 15, 2016 - - A little over a week ago I decided it would be fun to try to write my own multi-threaded init system in c. Without going into too much detail (I'll write @@ -20,9 +15,9 @@ reboot commands worked, or how my current init system executed runlevels 0 and Remembering something I found a ways back about kernel triggers found in and /sys/power/ for controlling acpi states, I started searching for something -similar. After a bit of time, I found */proc/sysrq-trigger*. For further -reading beyond this post, please see the -https://en.wikipedia.org/wiki/Magic_SysRq_key[Wikipedia Article]. +similar. After a bit of time, I found ``/proc/sysrq-trigger``. For further +reading beyond this post, please see the `Wikipedia Article +<https://en.wikipedia.org/wiki/Magic_SysRq_key>`_. @@ -31,30 +26,34 @@ Simple Usage The usage of sysrq-trigger is fairly simple. Before we get into exact usage for the purposes of shutting down or rebooting though, please note that output from -/proc/sysrq-trigger can only be seen from an actual tty, and not from within a -terminal emulator. +``/proc/sysrq-trigger`` can only be seen from an actual tty, and not from +within a terminal emulator. That said, execute the following command to find out all of the options available to you from sysrq. - # echo h > /proc/sysrq-trigger +:: + + # echo h > /proc/sysrq-trigger If you don't see output from that, either sysrq isn't enabled, or you aren't executing from within a tty. -To check if it is enabled, ensure that the following command yields a *1*. +To check if it is enabled, ensure that the following command yields a ``1``. - # cat /proc/sys/kernel/sysrq +:: + + # cat /proc/sys/kernel/sysrq Reboot and Shutdown Sequences ----------------------------- -If you executed the _echo h_ statement above, you likely saw the output of -supported commands. Among them you should havE seen *b* and *o*, for reboot and -poweroff, respectively. _Note that it is a bad idea to execute either of these -right now._ +If you executed the ``echo h`` statement above, you likely saw the output of +supported commands. Among them you should have seen ``b`` and ``o``, for reboot +and poweroff, respectively. **Note** that it is a bad idea to execute either of +these right now. If you read around the internet for what these two do, you'll see that both cause a hard stop. Neither polietly asks processes to exit. They are roughly @@ -66,41 +65,38 @@ possible. Here is the list of commands that should be sent to sysrq-trigger, in order, for both a shutdown and a reboot. -echo r > /proc/sysrq-trigger:: (un*R*aw) Takes back control of keyboard from X +* ``echo r > /proc/sysrq-trigger``: (un**R**aw) Takes back control of keyboard + from X -echo e > /proc/sysrq-trigger:: (t*E*rminate) Send SIGTERM to all processes. If - you aren't familiar with process signals, this - is basically a friendly kill command for every - process. +* ``echo e > /proc/sysrq-trigger``: (t**E**rminate) Send SIGTERM to all + processes. If you aren't familiar with process signals, this is basically a + friendly kill command for every process. -echo i > /proc/sysrq-trigger:: (k*I*ll) Send SIGKILL to all processes. If you - aren't familiar with process signals, this is - basically a kill -9 command for every remaining - process. +* ``echo i > /proc/sysrq-trigger``: (k**I**ll) Send SIGKILL to all processes. + If you aren't familiar with process signals, this is basically a kill -9 + command for every remaining process. -echo s > /proc/sysrq-trigger:: (*S*nc) Sync all cached disk operations to disk +* ``echo s > /proc/sysrq-trigger``: (**S**nc) Sync all cached disk operations + to disk -echo u > /proc/sysrq-trigger:: (*U*mount) Umounts all mounted partitions +* ``echo u > /proc/sysrq-trigger``: (**U**mount) Umounts all mounted partitions The previous commands all get us to a ready to shutdown or reboot state. To shutdown or reboot, execute one of the following. -echo o > /proc/sysrq-trigger:: (p*O*weroff) Powers off the system +``echo o > /proc/sysrq-trigger``: (p**O**weroff) Powers off the system -echo b > /proc/sysrq-trigger:: (re*B*oot) Reboots the system +``echo b > /proc/sysrq-trigger``: (re**B**oot) Reboots the system The entire list in order, using the reboot command... - # echo r > /proc/sysrq-trigger - # echo e > /proc/sysrq-trigger - # echo i > /proc/sysrq-trigger - # echo s > /proc/sysrq-trigger - # echo u > /proc/sysrq-trigger - # echo b > /proc/sysrq-trigger - +.. code-block:: sh -[role="datelastedit"] -Last edited: {revdate} -// vim: set syntax=asciidoc: + echo r > /proc/sysrq-trigger + echo e > /proc/sysrq-trigger + echo i > /proc/sysrq-trigger + echo s > /proc/sysrq-trigger + echo u > /proc/sysrq-trigger + echo b > /proc/sysrq-trigger |