From bfd74b9edf45c55715ef9aca326ac2399e267c87 Mon Sep 17 00:00:00 2001 From: Mahdi Fooladgar Date: Fri, 8 Dec 2023 12:23:55 +0330 Subject: [PATCH] Fix #17: Checking postgresql status on Ubuntu Signed-off-by: Mahdi Fooladgar --- controls/postgres_spec.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/controls/postgres_spec.rb b/controls/postgres_spec.rb index dc40f56..0fb93ee 100644 --- a/controls/postgres_spec.rb +++ b/controls/postgres_spec.rb @@ -38,10 +38,16 @@ impact 1.0 title 'Postgresql should be running' desc 'Postgresql should be running.' - describe service(postgres.service) do - it { should be_installed } - it { should be_running } - it { should be_enabled } + if os[:name] == "ubuntu" + describe command('/etc/init.d/postgresql status') do + its('stdout') { should include 'active' } + end + else + describe service(postgres.service) do + it { should be_installed } + it { should be_running } + it { should be_enabled } + end end end