refactor
This commit is contained in:
parent
06975ec5e1
commit
834a05e25a
|
@ -13,19 +13,16 @@ type ServiceName = String
|
|||
-- we can do is try to start the service, and if it fails, assume
|
||||
-- this means it's already running.
|
||||
running :: ServiceName -> Property
|
||||
running svc = property ("running " ++ svc) $ do
|
||||
void $ ensureProperty $
|
||||
scriptProperty ["service " ++ shellEscape svc ++ " start >/dev/null 2>&1 || true"]
|
||||
return NoChange
|
||||
running = signaled "start" "running"
|
||||
|
||||
restarted :: ServiceName -> Property
|
||||
restarted svc = property ("restarted " ++ svc) $ do
|
||||
void $ ensureProperty $
|
||||
scriptProperty ["service " ++ shellEscape svc ++ " restart >/dev/null 2>&1 || true"]
|
||||
return NoChange
|
||||
restarted = signaled "restart" "restarted"
|
||||
|
||||
reloaded :: ServiceName -> Property
|
||||
reloaded svc = property ("reloaded " ++ svc) $ do
|
||||
reloaded = signaled "reload" "reloaded"
|
||||
|
||||
signaled :: String -> Desc -> ServiceName -> Property
|
||||
signaled cmd desc svc = property (desc ++ " " ++ svc) $ do
|
||||
void $ ensureProperty $
|
||||
scriptProperty ["service " ++ shellEscape svc ++ " reload >/dev/null 2>&1 || true"]
|
||||
scriptProperty ["service " ++ shellEscape svc ++ " " ++ cmd ++ " >/dev/null 2>&1 || true"]
|
||||
return NoChange
|
||||
|
|
Loading…
Reference in New Issue