summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Propellor/Property/Cron.hs21
-rw-r--r--config.hs2
-rw-r--r--propellor.cabal1
3 files changed, 24 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"
diff --git a/config.hs b/config.hs
index e0dc485d..b3b525b0 100644
--- a/config.hs
+++ b/config.hs
@@ -7,6 +7,7 @@ import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Network as Network
import qualified Propellor.Property.Ssh as Ssh
+import qualified Propellor.Property.Cron as Cron
import qualified Propellor.Property.Sudo as Sudo
import qualified Propellor.Property.User as User
import qualified Propellor.Property.Hostname as Hostname
@@ -63,6 +64,7 @@ standardSystem suite = propertyList "standard system"
, Sudo.enabledFor "joey"
, GitHome.installedFor "joey"
, Apt.installed ["vim", "screen"]
+ , Cron.runPropellor "30 * * * *"
-- I use postfix, or no MTA.
, Apt.removed ["exim4"] `onChange` Apt.autoRemove
]
diff --git a/propellor.cabal b/propellor.cabal
index 19fde6cf..0abc7d7c 100644
--- a/propellor.cabal
+++ b/propellor.cabal
@@ -47,6 +47,7 @@ Library
Propellor.Property
Propellor.Property.Apt
Propellor.Property.Cmd
+ Propellor.Property.Cron
Propellor.Property.Docker
Propellor.Property.File
Propellor.Property.GitHome