diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2022-07-08 06:18:01 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2022-07-08 06:18:01 +0200 |
| commit | dbbba9dd08c6225b8c443eb9e03eda3a40334781 (patch) | |
| tree | d7c31aef163fc85b562310626816c511168a9b9d /src | |
| parent | 91dfc7988d2b3f452e2e852861f388eb665aeb28 (diff) | |
| download | sebastiano.tronto.net-dbbba9dd08c6225b8c443eb9e03eda3a40334781.tar.gz sebastiano.tronto.net-dbbba9dd08c6225b8c443eb9e03eda3a40334781.zip | |
New blog post
Diffstat (limited to 'src')
| -rw-r--r-- | src/blog/2022-07-07-shutdown/shutdown.md | 125 | ||||
| -rw-r--r-- | src/blog/blog.md | 1 | ||||
| -rw-r--r-- | src/blog/feed.xml | 7 |
3 files changed, 133 insertions, 0 deletions
diff --git a/src/blog/2022-07-07-shutdown/shutdown.md b/src/blog/2022-07-07-shutdown/shutdown.md new file mode 100644 index 0000000..b6ff7be --- /dev/null +++ b/src/blog/2022-07-07-shutdown/shutdown.md | |||
| @@ -0,0 +1,125 @@ | |||
| 1 | # The man page reading club: shutdown(8) | ||
| 2 | |||
| 3 | I would like to write about more interesting things, but I do not have | ||
| 4 | time or energy to do so. I need to shut down for a little while. | ||
| 5 | |||
| 6 | ## Sleeping in a sleepless time | ||
| 7 | |||
| 8 | *Reading. Learning. Fun. Tired.* | ||
| 9 | |||
| 10 | ``` | ||
| 11 | $ date | ||
| 12 | Thu Jul 7 22:57:50 CEST 2022 | ||
| 13 | ``` | ||
| 14 | |||
| 15 | *Not too late. You should do something.* | ||
| 16 | |||
| 17 | ``` | ||
| 18 | $ man man | ||
| 19 | NAME | ||
| 20 | man - display manual pages | ||
| 21 | ``` | ||
| 22 | |||
| 23 | *No, you have already done that one. What should you do?* | ||
| 24 | |||
| 25 | ``` | ||
| 26 | $ date | ||
| 27 | Thu Jul 7 22:59:48 CEST 2022 | ||
| 28 | ``` | ||
| 29 | |||
| 30 | *This is not going anywhere. Is it time to go to sleep? Who knows, | ||
| 31 | during the covid lockdown - ahem, nuclear winter - every hour looks the same. | ||
| 32 | Maybe it is time to go to sleep. To shutdown.* | ||
| 33 | |||
| 34 | ## shutdown(8) | ||
| 35 | |||
| 36 | *Follow along at [man.openbsd.org](https://man.openbsd.org/OpenBSD-7.1/shutdown)* | ||
| 37 | |||
| 38 | ``` | ||
| 39 | SYNOPSIS | ||
| 40 | shutdown [-] [-dfhknpr] time [warning-message ...] | ||
| 41 | |||
| 42 | DESCRIPTION | ||
| 43 | shutdown provides an automated shutdown procedure for superusers to | ||
| 44 | nicely notify users when the system is shutting down, saving them from | ||
| 45 | system administrators, hackers, and gurus, who would otherwise not bother | ||
| 46 | with such niceties. When the shutdown command is issued without options, | ||
| 47 | the system is placed in single user mode at the indicated time after | ||
| 48 | shutting down all system services. | ||
| 49 | ``` | ||
| 50 | |||
| 51 | As it sometimes happens, the first few lines of the manual page hint to some | ||
| 52 | arcane background that you cannot quite grasp. However, the bottom line is | ||
| 53 | clear: `shutdwon` shuts the system down. | ||
| 54 | |||
| 55 | ``` | ||
| 56 | The options are as follows: | ||
| 57 | -d When used with -h, -p, or -r causes system to perform a dump. | ||
| 58 | This option is useful for debugging system dump procedures [...]. | ||
| 59 | ``` | ||
| 60 | |||
| 61 | Good to keep in mind. But this time we are not in for an in-depth analysis of | ||
| 62 | a classic UNIX command. We just want to shut down. Let's skip a few of the | ||
| 63 | other options. | ||
| 64 | |||
| 65 | ``` | ||
| 66 | -p The system is powered down at the specified time. The -p flag is | ||
| 67 | passed on to halt(8), causing machines which support automatic | ||
| 68 | power down to do so after halting. | ||
| 69 | |||
| 70 | -r shutdown execs reboot(8) at the specified time. | ||
| 71 | ``` | ||
| 72 | |||
| 73 | Yes, these sound like things I would like to do. How do I tell it to | ||
| 74 | shut down now? | ||
| 75 | |||
| 76 | ``` | ||
| 77 | time time is the time at which shutdown will bring the system down and | ||
| 78 | may be the word now (indicating an immediate shutdown) or specify | ||
| 79 | a future time in one of two formats: +number or yymmddhhmm, | ||
| 80 | where the year, month, and day may be defaulted to the current | ||
| 81 | system values. The first form brings the system down in number | ||
| 82 | minutes and the second at the absolute time specified. | ||
| 83 | ``` | ||
| 84 | |||
| 85 | Great! | ||
| 86 | |||
| 87 | ``` | ||
| 88 | warning-message | ||
| 89 | Any other arguments comprise the warning message that is | ||
| 90 | broadcast to users currently logged into the system. | ||
| 91 | - If `-' is supplied as an option, the warning message is read from | ||
| 92 | the standard input. | ||
| 93 | ``` | ||
| 94 | |||
| 95 | Who do we have to warn about the shutdown? We are the only user anyway, right? | ||
| 96 | |||
| 97 | ``` | ||
| 98 | # echo 'the hours rise up putting off stars and it is | ||
| 99 | > dawn' | shutdown -p now - | ||
| 100 | ``` | ||
| 101 | |||
| 102 | ## Conclusions | ||
| 103 | |||
| 104 | At the moment of writing this blog post, I am tired. I had a busy week. | ||
| 105 | I wanted to write an interesting blog post about something like | ||
| 106 | sh(1), but I could not find the time. However, shutting down my pc earlier | ||
| 107 | today inspired me to write this short blog entry. | ||
| 108 | |||
| 109 | `shutdown` is an interesting command. It seems like it should be | ||
| 110 | straightforward: "computer, please shut down". But the syntax for this | ||
| 111 | simple instruction is quite complicated, and it offers us many more option | ||
| 112 | than we would ever want to use, at least in the 21st century. Moreover, as | ||
| 113 | indicated by the `#` instead of the `$` in the last command, one needs | ||
| 114 | superuser privileges to shut down a classic UNIX system. | ||
| 115 | |||
| 116 | This is because, in the time of mainframes, *shutting down* was not such a | ||
| 117 | simple operation: multiple users might have been connected to the main | ||
| 118 | computer, and shutting the whole system down without at least telling them | ||
| 119 | was rude. At least this is my guess, I was not there at the time. | ||
| 120 | |||
| 121 | It would certainly be interesting to dig into the history of computer systems, | ||
| 122 | mainframes and how administrators used to shut them down when multiple users | ||
| 123 | where logged in. But I am not going to do it now. | ||
| 124 | |||
| 125 | Good night. | ||
diff --git a/src/blog/blog.md b/src/blog/blog.md index 5b777ad..7b8095b 100644 --- a/src/blog/blog.md +++ b/src/blog/blog.md | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | [RSS Feed](feed.xml) | 3 | [RSS Feed](feed.xml) |
| 4 | 4 | ||
| 5 | * 2022-07-07 [The man page reading club: shutdown(8)](2022-07-07-shutdown) | ||
| 5 | * 2022-06-12 [The UNIX shell as an IDE: look stuff up with sed](2022-06-12-shell-ide-sed) | 6 | * 2022-06-12 [The UNIX shell as an IDE: look stuff up with sed](2022-06-12-shell-ide-sed) |
| 6 | * 2022-06-08 [The man page reading club: more(1)](2022-06-08-more) | 7 | * 2022-06-08 [The man page reading club: more(1)](2022-06-08-more) |
| 7 | * 2022-06-04 [The gemini protocol](2022-06-04-gemini) | 8 | * 2022-06-04 [The gemini protocol](2022-06-04-gemini) |
diff --git a/src/blog/feed.xml b/src/blog/feed.xml index 567c6b2..a91f184 100644 --- a/src/blog/feed.xml +++ b/src/blog/feed.xml | |||
| @@ -9,6 +9,13 @@ Thoughts about software, computers and whatever I feel like sharing | |||
| 9 | </description> | 9 | </description> |
| 10 | 10 | ||
| 11 | <item> | 11 | <item> |
| 12 | <title>The man page reading club: shutdown(8)</title> | ||
| 13 | <link>https://sebastiano.tronto.net/blog/2022-07-07-shutdown</link> | ||
| 14 | <description>The man page reading club: shutdown(8)</description> | ||
| 15 | <pubDate>2022-07-07</pubDate> | ||
| 16 | </item> | ||
| 17 | |||
| 18 | <item> | ||
| 12 | <title>The UNIX shell as an IDE: look stuff up with sed</title> | 19 | <title>The UNIX shell as an IDE: look stuff up with sed</title> |
| 13 | <link>https://sebastiano.tronto.net/blog/2022-06-12-shell-ide-sed</link> | 20 | <link>https://sebastiano.tronto.net/blog/2022-06-12-shell-ide-sed</link> |
| 14 | <description>The UNIX shell as an IDE: look stuff up with sed</description> | 21 | <description>The UNIX shell as an IDE: look stuff up with sed</description> |
