summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Cron.hs
diff options
context:
space:
mode:
authorJoey Hess2015-04-22 13:50:16 -0400
committerJoey Hess2015-04-22 13:50:16 -0400
commit66a8012a1a1086dd15c18e48fd95b27687d10c87 (patch)
tree6e911e3dcaa1bb18528d22a190d8016f7a9e3d0e /src/Propellor/Property/Cron.hs
parent0fc926934a8e5c736219d0a53790de2fd1e2b87c (diff)
parent4bd933118d9ecb711b19a6db7b94f24c2733d1a2 (diff)
Merge branch 'joeyconfig'
Conflicts: privdata.joey/privdata.gpg
Diffstat (limited to 'src/Propellor/Property/Cron.hs')
-rw-r--r--src/Propellor/Property/Cron.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Propellor/Property/Cron.hs b/src/Propellor/Property/Cron.hs
index 222f3849..d2feaf3c 100644
--- a/src/Propellor/Property/Cron.hs
+++ b/src/Propellor/Property/Cron.hs
@@ -28,8 +28,8 @@ data Times
-- job file.
--
-- The cron job's output will only be emailed if it exits nonzero.
-job :: Desc -> Times -> UserName -> FilePath -> String -> Property NoInfo
-job desc times user cddir command = combineProperties ("cronned " ++ desc)
+job :: Desc -> Times -> User -> FilePath -> String -> Property NoInfo
+job desc times (User u) cddir command = combineProperties ("cronned " ++ desc)
[ cronjobfile `File.hasContent`
[ case times of
Times _ -> ""
@@ -40,10 +40,10 @@ job desc times user cddir command = combineProperties ("cronned " ++ desc)
, "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
, ""
, case times of
- Times t -> t ++ "\t" ++ user ++ "\tchronic " ++ shellEscape scriptfile
- _ -> case user of
+ Times t -> t ++ "\t" ++ u ++ "\tchronic " ++ shellEscape scriptfile
+ _ -> case u of
"root" -> "chronic " ++ shellEscape scriptfile
- _ -> "chronic su " ++ user ++ " -c " ++ shellEscape scriptfile
+ _ -> "chronic su " ++ u ++ " -c " ++ shellEscape scriptfile
]
, case times of
Times _ -> doNothing
@@ -76,11 +76,11 @@ job desc times user cddir command = combineProperties ("cronned " ++ desc)
| otherwise = '_'
-- | Installs a cron job, and runs it niced and ioniced.
-niceJob :: Desc -> Times -> UserName -> FilePath -> String -> Property NoInfo
+niceJob :: Desc -> Times -> User -> FilePath -> String -> Property NoInfo
niceJob desc times user cddir command = job desc times user cddir
("nice ionice -c 3 sh -c " ++ shellEscape command)
-- | Installs a cron job to run propellor.
runPropellor :: Times -> Property NoInfo
-runPropellor times = niceJob "propellor" times "root" localdir
+runPropellor times = niceJob "propellor" times (User "root") localdir
(bootstrapPropellorCommand ++ "; ./propellor")