server: new command log, to quickly show last logs from journalctl
This commit is contained in:
parent
8bfdf91941
commit
a7c542f3f3
2 changed files with 21 additions and 1 deletions
|
@ -104,7 +104,7 @@ case "${subcommand}" in
|
|||
"${LIBDIR}/bkctld-${subcommand}" "${jail_name}" "${option}"
|
||||
fi
|
||||
;;
|
||||
"start" | "stop" | "reload" | "restart" | "sync" | "update" | "remove" | "firewall" | "upgrade-config" | "archive")
|
||||
"start" | "stop" | "reload" | "restart" | "sync" | "update" | "remove" | "firewall" | "upgrade-config" | "archive" | "log")
|
||||
jail_name="${2:-}"
|
||||
if [ "${jail_name}" = "all" ]; then
|
||||
for jail in $("${LIBDIR}/bkctld-list"); do
|
||||
|
|
20
server/lib/bkctld-log
Executable file
20
server/lib/bkctld-log
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Description: Show jail log (with journalctl)
|
||||
# Usage: log <jailname>
|
||||
#
|
||||
|
||||
set -eu
|
||||
|
||||
# shellcheck source=./includes
|
||||
LIBDIR="$(dirname $0)" && . "${LIBDIR}/includes"
|
||||
|
||||
jail_name="${1:?}"
|
||||
if [ -z "${jail_name}" ]; then
|
||||
show_help && exit 1
|
||||
fi
|
||||
jail_path=$(jail_path "${jail_name}")
|
||||
|
||||
test -d "${jail_path}" || error "${jail_name}: jail not found" 2
|
||||
|
||||
journalctl --reverse --unit systemd-nspawn@${jail_name}
|
Loading…
Add table
Reference in a new issue