From 51fc590b61a7e68a5e038919f1aaea7a1d9fcc71 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 31 Mar 2014 01:29:47 -0400 Subject: propellor spin --- Propellor/Property/Cron.hs | 21 +++++++++++++++++++++ config.hs | 2 ++ propellor.cabal | 1 + 3 files changed, 24 insertions(+) create mode 100644 Propellor/Property/Cron.hs 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 -- cgit v1.2.3