diff options
-rw-r--r-- | man/halt.xml | 8 | ||||
-rw-r--r-- | src/systemctl/systemctl.c | 10 |
2 files changed, 16 insertions, 2 deletions
diff --git a/man/halt.xml b/man/halt.xml index a06dbd0097..e3fa60a915 100644 --- a/man/halt.xml +++ b/man/halt.xml @@ -133,6 +133,14 @@ </varlistentry> <varlistentry> + <term><option>-n</option></term> + <term><option>--no-sync</option></term> + + <listitem><para>Don't sync hard disks/storage media before + halt, power-off, reboot.</para></listitem> + </varlistentry> + + <varlistentry> <term><option>--no-wall</option></term> <listitem><para>Do not send wall message before halt, diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 0faf37d320..3b4678c119 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -102,6 +102,7 @@ static bool arg_no_block = false; static bool arg_no_legend = false; static bool arg_no_pager = false; static bool arg_no_wtmp = false; +static bool arg_no_sync = false; static bool arg_no_wall = false; static bool arg_no_reload = false; static bool arg_value = false; @@ -6926,6 +6927,7 @@ static int halt_parse_argv(int argc, char *argv[]) { { "force", no_argument, NULL, 'f' }, { "wtmp-only", no_argument, NULL, 'w' }, { "no-wtmp", no_argument, NULL, 'd' }, + { "no-sync", no_argument, NULL, 'n' }, { "no-wall", no_argument, NULL, ARG_NO_WALL }, {} }; @@ -6971,13 +6973,16 @@ static int halt_parse_argv(int argc, char *argv[]) { arg_no_wtmp = true; break; + case 'n': + arg_no_sync = true; + break; + case ARG_NO_WALL: arg_no_wall = true; break; case 'i': case 'h': - case 'n': /* Compatibility nops */ break; @@ -7496,7 +7501,8 @@ static int halt_now(enum action a) { /* The kernel will automaticall flush ATA disks and suchlike * on reboot(), but the file systems need to be synce'd * explicitly in advance. */ - (void) sync(); + if (!arg_no_sync) + (void) sync(); /* Make sure C-A-D is handled by the kernel from this point * on... */ |