Extract status action
This commit is contained in:
parent
f686bbb60b
commit
f29e0bc075
|
@ -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
|
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue