diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-01 01:12:05 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-01 01:12:05 -0400 |
| commit | 90f86b8b2bb7f0a3c834387827c9ec2e1876f342 (patch) | |
| tree | 10e74b0a52f4987c6f7e9cf2abf756275e0cefae /Propellor/Property/Cmd.hs | |
| parent | d53729495efe7174239deab3b5dd71204543b0d0 (diff) | |
not quite working docker container interface
Diffstat (limited to 'Propellor/Property/Cmd.hs')
| -rw-r--r-- | Propellor/Property/Cmd.hs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Propellor/Property/Cmd.hs b/Propellor/Property/Cmd.hs index 88a84968..3e496b82 100644 --- a/Propellor/Property/Cmd.hs +++ b/Propellor/Property/Cmd.hs @@ -1,7 +1,8 @@ module Propellor.Property.Cmd ( cmdProperty, cmdProperty', - scriptProperty + scriptProperty, + serviceRunning, ) where import Control.Applicative @@ -35,3 +36,12 @@ scriptProperty :: [String] -> Property scriptProperty script = cmdProperty "sh" ["-c", shellcmd] where shellcmd = intercalate " ; " ("set -e" : script) + +-- | Ensures that a service is running. +-- +-- Note that due to the general poor state of init scripts, the best +-- we can do is try to start the service, and if it fails, assume +-- this means it's already running. +serviceRunning :: String -> Property +serviceRunning svc = scriptProperty + ["service " ++ shellEscape svc ++ " start >/dev/null 2>&1 || true"] |
