# HG changeset patch # User wenzelm # Date 1573666243 -3600 # Node ID cd166c3904dd98170053ac7e75ab586b107be42b # Parent 070a9b62f44abaecc315956c0e979035325e1b3c more robust: system ssh service is required for Phabricator ssh service; diff -r 070a9b62f44a -r cd166c3904dd src/Pure/System/linux.scala --- a/src/Pure/System/linux.scala Wed Nov 13 17:34:35 2019 +0100 +++ b/src/Pure/System/linux.scala Wed Nov 13 18:30:43 2019 +0100 @@ -121,8 +121,16 @@ def service_stop(name: String) { service_operation("stop", name) } def service_restart(name: String) { service_operation("restart", name) } + def service_shutdown(name: String) + { + try { service_stop(name) } + catch { case ERROR(_) => } + } + def service_install(name: String, spec: String) { + service_shutdown(name) + val service_file = Path.explode("/lib/systemd/system") + Path.basic(name).ext("service") File.write(service_file, spec) Isabelle_System.bash("chmod 0644 " + File.bash_path(service_file)).check diff -r 070a9b62f44a -r cd166c3904dd src/Pure/Tools/phabricator.scala --- a/src/Pure/Tools/phabricator.scala Wed Nov 13 17:34:35 2019 +0100 +++ b/src/Pure/Tools/phabricator.scala Wed Nov 13 18:30:43 2019 +0100 @@ -569,14 +569,16 @@ val ssh_name = isabelle_phabricator_name(name = "ssh") val ssh_command = Path.explode("/usr/local/bin") + Path.basic(ssh_name) + Linux.service_shutdown(ssh_name) + val old_system_port = read_ssh_port(sshd_conf_system) if (old_system_port != system_port) { progress.echo("Reconfigurig system ssh service") - Linux.service_stop("ssh") + Linux.service_shutdown("ssh") write_ssh_port(sshd_conf_system, system_port) + Linux.service_start("ssh") } - progress.echo("Configuring " + ssh_name + " service") File.write(ssh_command, @@ -651,11 +653,6 @@ Bash.string(config.name) + """@localhost conduit conduit.ping""").print } } - - if (old_system_port != system_port) { - progress.echo("Restarting system ssh service") - Linux.service_start("ssh") - } }