diff --git a/actions/service b/actions/service index a9ea57ac9..7588321db 100755 --- a/actions/service +++ b/actions/service @@ -5,9 +5,7 @@ Wrapper to list and handle system services """ import argparse -import json import os -import subprocess from importlib import import_module from plinth import action_utils, cfg @@ -39,8 +37,6 @@ def parse_arguments(): add_service_action(subparsers, 'mask', 'unmask a service') add_service_action(subparsers, 'unmask', 'unmask a service') - subparsers.add_parser('list', help='List of running system services') - subparsers.required = True return parser.parse_args() @@ -89,36 +85,6 @@ def subcommand_is_running(arguments): print(action_utils.service_is_running(arguments.service)) -def subcommand_list(_): - """Get list of plinth-managed services with their status. - - Status may be either running or not. - - """ - managed_services = _get_managed_services() - services = dict.fromkeys(managed_services, {'running': False}) - - output = subprocess.check_output(['systemctl', 'list-units']) - for line in output.decode().strip().split('\n'): - if line.startswith('UNIT'): - continue - # Stop parsing on empty line after the service list - if not len(line): - break - - try: - unit, load, active, sub = line.split()[:4] - except ValueError: - continue - suffix = '.service' - if unit.endswith(suffix): - name = unit[:-len(suffix)] - if name in services: - services[name] = {'running': (sub == 'running')} - - print(json.dumps(services)) - - def _get_managed_services_of_module(modulepath): """Import a module and return content of its 'managed_services' variable""" try: