diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-17 22:28:21 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-17 22:28:21 -0400 |
| commit | 27ff3e9f2188f899c1130b5876ed19ca124df3b4 (patch) | |
| tree | 0ee94fa989e4d5b2f6c1539eac35dc0b0ce8db18 /Propellor/Property/Cron.hs | |
| parent | 26548768a53d9f1d26020c1d486c7fd3d6772162 (diff) | |
| parent | bddb6306f533f79da068db897b4938fdd3d29920 (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'Propellor/Property/Cron.hs')
| -rw-r--r-- | Propellor/Property/Cron.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Propellor/Property/Cron.hs b/Propellor/Property/Cron.hs index 71580bc3..0649ee9f 100644 --- a/Propellor/Property/Cron.hs +++ b/Propellor/Property/Cron.hs @@ -16,6 +16,8 @@ type CronTimes = String -- Only one instance of the cron job is allowed to run at a time, no matter -- how long it runs. This is accomplished using flock locking of the cron -- job file. +-- +-- The cron job's output will only be emailed if it exits nonzero. job :: Desc -> CronTimes -> UserName -> FilePath -> String -> Property job desc times user cddir command = cronjobfile `File.hasContent` [ "# Generated by propellor" @@ -24,10 +26,11 @@ job desc times user cddir command = cronjobfile `File.hasContent` , "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" , "" , times ++ "\t" ++ user ++ "\t" - ++ "flock -n " ++ shellEscape cronjobfile + ++ "chronic flock -n " ++ shellEscape cronjobfile ++ " sh -c " ++ shellEscape cmdline ] `requires` Apt.serviceInstalledRunning "cron" + `requires` Apt.installed ["util-linux", "moreutils"] `describe` ("cronned " ++ desc) where cmdline = "cd " ++ cddir ++ " && " ++ command @@ -40,8 +43,7 @@ job desc times user cddir command = cronjobfile `File.hasContent` niceJob :: Desc -> CronTimes -> UserName -> FilePath -> String -> Property niceJob desc times user cddir command = job desc times user cddir ("nice ionice -c 3 " ++ command) - `requires` Apt.installed ["util-linux", "moreutils"] -- | Installs a cron job to run propellor. runPropellor :: CronTimes -> Property -runPropellor times = niceJob "propellor" times "root" localdir "chronic make" +runPropellor times = niceJob "propellor" times "root" localdir "make" |
