From: Alex Musolino <alex@musolino.id.au>
To: 9front@9front.org
Subject: -d option for fshalt
Date: Tue, 2 Jun 2020 14:07:44 +0930 [thread overview]
Message-ID: <08D04ADCF6BC5A7E9B1225642948AAB8@musolino.id.au> (raw)
Hi all,
I've added support for a -d option in fshalt(8) that triggers a dump
of the local filesystem before halting. I've found it useful in my
current situation where my 9front machine spends most of its time
powered off.
Any objections to the following?
diff -r 8006152d13d2 rc/bin/fshalt
--- a/rc/bin/fshalt Tue Apr 28 20:51:19 2020 -0700
+++ b/rc/bin/fshalt Tue Jun 02 14:03:03 2020 +0930
@@ -1,16 +1,20 @@
#!/bin/rc
-# fshalt [-r] - sync (flush) and, if possible, halt all file servers
-# and optionally reboot
rfork en
+dump=no
reboot=no
scram=no
-switch ($#*) {
-case 0
-case 1
- reboot=yes
-case *
- echo usage: $0 '[-r]' >[1=2]
- exit usage
+
+while (~ $1 -*) {
+ switch ($1) {
+ case -d
+ dump=yes
+ case -r
+ reboot=yes
+ case *
+ echo usage: $0 '[-r]' >[1=2]
+ exit usage
+ }
+ shift
}
path=(/bin)
@@ -53,6 +57,13 @@
# when it's no longer accessible
fn x {
echo
+ echo -n dumping...
+ if (~ $dump yes) {
+ for (i in $c $h)
+ echo dump >>$i
+ }
+
+ echo
echo -n halting...
for (i in $c $h)
echo halt >>$i
diff -r 8006152d13d2 sys/man/8/fshalt
--- a/sys/man/8/fshalt Tue Apr 28 20:51:19 2020 -0700
+++ b/sys/man/8/fshalt Tue Jun 02 14:03:03 2020 +0930
@@ -4,6 +4,8 @@
.SH SYNOPSIS
.B fshalt
[
+.B -d
+] [
.B -r
]
.br
@@ -20,13 +22,15 @@
and
.IR hjfs (4)
servers.
-If given
-.BR -r ,
-.I fshalt
-will then reboot the machine.
-Else it will invoke
+The
+.BR -d
+option causes a dump command to be issued to the local filesystem
+before the sync and halt commands. Once any filesystems have been
+halted,
.I scram
-to shut down the machine.
+will be invoked to shut down the machine, unless the
+.BR -r
+option is specified, in which case the machine is instead rebooted.
The halting and rebooting is done by copying all necessary
commands into a
.IR ramfs (4)
next reply other threads:[~2020-06-02 4:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-02 4:37 Alex Musolino [this message]
2020-06-02 4:58 ` [9front] " Alex Musolino
2020-06-02 6:54 ` Alex Musolino
2020-06-02 6:59 ` rgl
2020-06-04 6:57 ` Alex Musolino
2020-06-04 12:27 ` kvik
2020-06-04 13:57 ` Alex Musolino
2020-06-04 15:50 ` kvik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=08D04ADCF6BC5A7E9B1225642948AAB8@musolino.id.au \
--to=alex@musolino.id.au \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).