[Groonga-commit] droonga/droonga-engine at 2dd6868 [master] Use systemctl command instead of service command to manage droonga-engine process

Back to archive index

KITAITI Makoto null+****@clear*****
Sat Jan 23 17:48:24 JST 2016


KITAITI Makoto	2016-01-23 17:48:24 +0900 (Sat, 23 Jan 2016)

  New Revision: 2dd68685f2c0e1b5208add13a4bba65de9f79b23
  https://github.com/droonga/droonga-engine/commit/2dd68685f2c0e1b5208add13a4bba65de9f79b23

  Merged 0c1e198: Merge pull request #39 from KitaitiMakoto/systemd

  Message:
    Use systemctl command instead of service command to manage droonga-engine process

  Modified files:
    lib/droonga/service_installation.rb

  Modified: lib/droonga/service_installation.rb (+6 -17)
===================================================================
--- lib/droonga/service_installation.rb    2016-01-19 14:10:19 +0900 (02a772f)
+++ lib/droonga/service_installation.rb    2016-01-23 17:48:24 +0900 (a69628d)
@@ -76,17 +76,9 @@ module Droonga
     def installed_as_service?
       return false unless user_exist?
 
-      #TODO: we should support systemd also...
-      succeeded = system("service", "droonga-engine", "status",
-                         :out => "/dev/null",
-                         :err => "/dev/null")
-      return true if succeeded
-
-      #TODO: we should support systemd also...
-      result = `service droonga-engine status`
-      result.include?("running") or \
-        result.include?("droonga-engine is stopped") or \
-        result.include?("droonga-engine dead")
+      system("systemctl", "is-enabled", "droonga-engine.srvice",
+             :out => "/dev/null",
+             :err => "/dev/null")
     end
 
     def ensure_correct_file_permission(file)
@@ -98,24 +90,21 @@ module Droonga
 
     def running?(pid_file_path=nil)
       raise NotInstalledAsService.new unless installed_as_service?
-      #TODO: we should support systemd also...
-      system("service", "droonga-engine", "status",
+      system("systemctl", "is-active", "droonga-engine",
              :out => "/dev/null",
              :err => "/dev/null")
     end
 
     def start
       raise NotInstalledAsService.new unless installed_as_service?
-      #TODO: we should support systemd also...
-      system("service", "droonga-engine", "start",
+      system("systemctl", "start", "droonga-engine",
              :out => "/dev/null",
              :err => "/dev/null")
     end
 
     def stop
       raise NotInstalledAsService.new unless installed_as_service?
-      #TODO: we should support systemd also...
-      system("service", "droonga-engine", "stop",
+      system("systemctl", "stop", "droonga-engine",
              :out => "/dev/null",
              :err => "/dev/null")
     end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index