||6 months ago|
|.gitignore||6 months ago|
|Makefile||6 months ago|
|README.md||6 months ago|
|poweroff_guard.8||6 months ago|
|poweroff_guard.c||6 months ago|
This utility is a proxy for
poweroff to prevent you from accidentally shutting down
the wrong system. It does this by printing a warning message and asking for confirmation
followed by a countdown before executing the actual command.
It is most useful when creating an alias for
poweroff in your shell, like:
If the standard output is not a tty, this behaves exactly like the regular
Open a shell in this directory and type
Optionally, you may want to append any of the following options:
POWEROFF_PATH=/path/to/poweroff: Specify a custom (absolute) path for the the real
poweroffcommand. The default is to use the one in your
COUNTDOWN_SECS=n: Start the countdown timer at
nseconds, the default is 10.
EXTRA_CFLAGS=...: Append extra flags to the C compiler.
# build with default options make # build with all custom options make \ POWEROFF_PATH=/bin/custom_poweroff \ COUNTDOWN_SECS=5 \ EXTRA_CFLAGS="-O2 -march=native"
If you want to recompile with different options, you MUST execute a
make clean first.
Make will erroneously think the binary is already up to date otherwise.
Do the exact same as building, but append
install at the end of the command.
# build and install with default options make install # build and install with all custom options make \ POWEROFF_PATH=/sbin/custom_poweroff \ COUNTDOWN_SECS=5 \ EXTRA_CFLAGS="-O2 -march=native" \ install
License and Copyright
Copyright © 2022 anna .
This program is licensed under the 2-clause BSD license.
The license text is at the end of the