mirror of
https://github.com/chatmail/relay.git
synced 2026-05-13 17:34:38 +00:00
add status command and delete last script
This commit is contained in:
@@ -81,6 +81,7 @@ def get_parser():
|
||||
)
|
||||
|
||||
add_subcommand(subparsers, dns_cmd)
|
||||
add_subcommand(subparsers, status_cmd)
|
||||
add_subcommand(subparsers, bench_cmd)
|
||||
add_subcommand(subparsers, test_cmd)
|
||||
add_subcommand(subparsers, webdev_cmd)
|
||||
@@ -112,6 +113,28 @@ def run_cmd(args, out, config):
|
||||
subprocess.check_call(popen_args, env=env)
|
||||
|
||||
|
||||
def status_cmd(args, out, config):
|
||||
"""Display status for online chatmail instance."""
|
||||
|
||||
ssh = f"ssh root@{config.mailname}"
|
||||
|
||||
def shell_output(arg):
|
||||
return subprocess.check_output(arg, shell=True).decode()
|
||||
|
||||
out.green(f"chatmail domain: {config.mailname}")
|
||||
if config.privacy_mail:
|
||||
out.green("privacy settings: present")
|
||||
else:
|
||||
out.red("no privacy settings")
|
||||
|
||||
out(f"[retrieving info by invoking {ssh}]", file=sys.stderr)
|
||||
|
||||
s1 = "systemctl --type=service --state=running"
|
||||
for line in shell_output(f"{ssh} -- {s1}").split("\n"):
|
||||
if line.startswith(" "):
|
||||
print(line)
|
||||
|
||||
|
||||
def webdev_cmd(args, out, config):
|
||||
"""Run local web development loop for static web pages."""
|
||||
from .www import main
|
||||
|
||||
Reference in New Issue
Block a user