diff options
author | Guido Günther <agx@sigxcpu.org> | 2014-12-28 15:04:15 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-12-28 15:04:15 +0100 |
commit | ffc774e01dc6651d0d74e475b1dc7fac44d43788 (patch) | |
tree | 0c19a2131090c65ac8f71165b2338081b315b266 /whatmaps/command.py | |
parent | 36fd4eee614a35fece4ccc085af73d92ce5de2a4 (diff) | |
parent | 1ee865fefdd5267c2ada84cc370f2005b6b1a5b6 (diff) |
Merge tag 'v0.0.9' into debian/master
whatmaps v0.0.9
Diffstat (limited to 'whatmaps/command.py')
-rwxr-xr-x | whatmaps/command.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/whatmaps/command.py b/whatmaps/command.py index 7690ef8..d0f5c3e 100755 --- a/whatmaps/command.py +++ b/whatmaps/command.py @@ -39,7 +39,7 @@ def check_maps(procs, shared_objects): restart_procs[proc.exe] += [ proc ] else: restart_procs[proc.exe] = [ proc ] - continue + break return restart_procs @@ -59,7 +59,7 @@ def write_cmd_file(services, cmd_file, distro): out = open(cmd_file, 'w') print('#! /bin/sh', file=out) for service in services: - logging.debug("Need to restart %s", service) + logging.info("Need to restart '%s'", service) print(" ".join(distro.restart_service_cmd(service)), file=out) out.close() os.chmod(cmd_file, 0o755) @@ -113,7 +113,12 @@ def find_systemd_units(procmap, distro): for dummy, procs in procmap.items(): for proc in procs: - unit = Systemd.process_to_unit(proc) + try: + unit = Systemd.process_to_unit(proc) + except ValueError as e: + logging.warning("No systemd unit found for '%s': %s" + "- restart manually" % (proc.exe, e)) + continue if not unit: logging.warning("No systemd unit found for '%s'" "- restart manually" % proc.exe) @@ -225,7 +230,7 @@ def main(argv): write_cmd_file(services, options.print_cmds, distro) else: for service in services: - logging.info("Restarting %s" % service) + logging.info("Restarting '%s'" % service) distro.restart_service(service) elif services: print("Services that possibly need to be restarted:") |