Class: Systemdy::Utility::Validator
- Inherits:
-
Object
- Object
- Systemdy::Utility::Validator
- Defined in:
- lib/systemdy/utility/validator.rb
Overview
Allows to add validation to a class
Class Method Summary collapse
-
.check_if_a_service_exist(name_of_the_service) ⇒ Boolean
a method for check if a service is intalled on the system.
Class Method Details
.check_if_a_service_exist(name_of_the_service) ⇒ Boolean
a method for check if a service is intalled on the system
13 14 15 16 17 18 |
# File 'lib/systemdy/utility/validator.rb', line 13 def self.check_if_a_service_exist(name_of_the_service) `#{SYSTEMCTL_COMMAND} list-unit-files #{name_of_the_service}.service | wc -l`.to_i > 3 # 'systemctl list-unit-files name_of_service.service | wc -l' command output: # 3 when there are not matching units(the service not exist because isn't installed on the system) # >3 when there are matching units(the service exist because is installed on the system) end |