summaryrefslogtreecommitdiff
path: root/Propellor/Property/Cron.hs
blob: 212e94e91eed50d363a7cbfd6790d73b9a20066e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module Propellor.Property.Cron where

import Propellor
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
import Propellor.CmdLine

type CronTimes = String

-- | Installs a cron job to run propellor.
runPropellor :: CronTimes -> Property
runPropellor times = "/etc/cron.d/propellor" `File.hasContent`
	[ "# Run propellor"
	, ""
	, "SHELL=/bin/sh"
	, "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
	, ""
	, times ++ "\troot\tcd " ++ localdir ++ " && nice ionice -c 3 chronic make"
	]
	`requires` Apt.installed ["util-linux", "cron", "moreutils"]
	`describe` "cronned propeller"