summaryrefslogtreecommitdiff
path: root/Propellor/Property/Cron.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Propellor/Property/Cron.hs')
-rw-r--r--Propellor/Property/Cron.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/Propellor/Property/Cron.hs b/Propellor/Property/Cron.hs
new file mode 100644
index 00000000..a3bc745d
--- /dev/null
+++ b/Propellor/Property/Cron.hs
@@ -0,0 +1,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 ["moreutils"]
+ `describe` "cronned propeller"