Extract status action

This commit is contained in:
jonct 2024-07-15 02:08:09 -04:00
parent f686bbb60b
commit f29e0bc075
No known key found for this signature in database
2 changed files with 18 additions and 10 deletions

View File

@ -0,0 +1,17 @@
# SPDX-FileCopyrightText: © 2024 Jip-Hop and the Jailmakers <https://github.com/Jip-Hop/jailmaker>
#
# SPDX-License-Identifier: LGPL-3.0-only
import subprocess
from utils.paths import SHORTNAME
def status_jail(jail_name, args):
"""
Show the status of the systemd service wrapping the jail with given name.
"""
# Alternatively `machinectl status jail_name` could be used
return subprocess.run(
["systemctl", "status", f"{SHORTNAME}-{jail_name}", *args]
).returncode

View File

@ -142,16 +142,7 @@ from utils.console import eprint, fail
from utils.jail_dataset import get_jail_path, get_jail_config_path, get_jail_rootfs_path from utils.jail_dataset import get_jail_path, get_jail_config_path, get_jail_rootfs_path
from actions.exec import exec_jail from actions.exec import exec_jail
from actions.status import status_jail
def status_jail(jail_name, args):
"""
Show the status of the systemd service wrapping the jail with given name.
"""
# Alternatively `machinectl status jail_name` could be used
return subprocess.run(
["systemctl", "status", f"{SHORTNAME}-{jail_name}", *args]
).returncode
def log_jail(jail_name, args): def log_jail(jail_name, args):