diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-12 22:36:36 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-12 22:36:36 -0400 |
| commit | c7830f4e669735bf46945592b315e7e367129888 (patch) | |
| tree | ae210656a5e5bc63568e163561847e655dcc971d /Propellor/Property/Cron.hs | |
| parent | 596c6590e8d83a5e81503f991debd5c804600af8 (diff) | |
propellor spin
Diffstat (limited to 'Propellor/Property/Cron.hs')
| -rw-r--r-- | Propellor/Property/Cron.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Propellor/Property/Cron.hs b/Propellor/Property/Cron.hs index fa6019ea..2fa9c87e 100644 --- a/Propellor/Property/Cron.hs +++ b/Propellor/Property/Cron.hs @@ -4,13 +4,15 @@ import Propellor import qualified Propellor.Property.File as File import qualified Propellor.Property.Apt as Apt +import Data.Char + type CronTimes = String -- | Installs a cron job, run as a specificed user, in a particular --directory. Note that the Desc must be unique, as it is used for the --cron.d/ filename. job :: Desc -> CronTimes -> UserName -> FilePath -> String -> Property -job desc times user cddir command = ("/etc/cron.d/" ++ desc) `File.hasContent` +job desc times user cddir command = cronjobfile `File.hasContent` [ "# Generated by propellor" , "" , "SHELL=/bin/sh" @@ -20,6 +22,11 @@ job desc times user cddir command = ("/etc/cron.d/" ++ desc) `File.hasContent` ] `requires` Apt.serviceInstalledRunning "cron" `describe` ("cronned " ++ desc) + where + cronjobfile = "/etc/cron.d/" ++ map sanitize desc + sanitize c + | isAlphaNum c = c + | otherwise = '_' -- | Installs a cron job, and runs it niced and ioniced. niceJob :: Desc -> CronTimes -> UserName -> FilePath -> String -> Property |
