From 79f1a6c67b72b695b23db69aaa606dc79c313d86 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 17 Jul 2014 15:33:02 -0400 Subject: propellor spin --- src/Propellor/Property/Cron.hs | 2 +- src/Propellor/Property/SiteSpecific/JoeySites.hs | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/Cron.hs b/src/Propellor/Property/Cron.hs index 5b070eff..d7138e3b 100644 --- a/src/Propellor/Property/Cron.hs +++ b/src/Propellor/Property/Cron.hs @@ -42,7 +42,7 @@ job desc times user cddir command = cronjobfile `File.hasContent` -- | Installs a cron job, and runs it niced and ioniced. niceJob :: Desc -> CronTimes -> UserName -> FilePath -> String -> Property niceJob desc times user cddir command = job desc times user cddir - ("nice ionice -c 3 " ++ command) + ("nice ionice -c 3 sh -c " ++ shellEscape command) -- | Installs a cron job to run propellor. runPropellor :: CronTimes -> Property diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs index c770907b..fbb1492b 100644 --- a/src/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs @@ -348,8 +348,26 @@ githubBackup = propertyList "github-backup box" , let f = "/home/joey/.github-keys" in File.hasPrivContent f anyContext `onChange` File.ownerGroup f "joey" "joey" + , Cron.niceJob "github-backup run" "30 4 * * *" "joey" + "/home/joey/lib/backup" $ intercalate "&" + [ "mkdir -p github" + , "cd github" + , "$HOME/.github-keys && github-backup joeyh" + ] ] +rsyncNetBackup :: [Host] -> Property +rsyncNetBackup hosts = Cron.niceJob "rsync.net copied in daily" "30 5 * * *" + "joey" "/home/joey/lib/backup" "mkdir -p rsync.net && rsync --delete -az 2318@usw-s002.rsync.net: rsync.net" + `requires` Ssh.knownHost hosts "usw-s002.rsync.net" "joey" + +backupsBackedupTo :: [Host] -> HostName -> FilePath -> Property +backupsBackedupTo hosts desthost destdir = Cron.niceJob "backups copied to usbackup weekly" + "1 1 * * 3" "joey" "/" cmd + `requires` Ssh.knownHost hosts desthost "joey" + where + cmd = "rsync -az --delete /home/joey/lib/backup " ++ desthost ++ ":" ++ destdir + obnamRepos :: [String] -> Property obnamRepos rs = propertyList ("obnam repos for " ++ unwords rs) (mkbase : map mkrepo rs) @@ -360,3 +378,8 @@ obnamRepos rs = propertyList ("obnam repos for " ++ unwords rs) mkdir d = File.dirExists d `before` File.ownerGroup d "joey" "joey" +podcatcher :: Property +podcatcher = Cron.niceJob "podcatcher run hourly" "55 * * * *" + "joey" "/home/joey/lib/sound/podcasts" + "xargs git-annex importfeed -c annex.genmetadata=true < feeds; mr --quiet update" + `requires` Apt.installed ["git-annex"] -- cgit v1.2.3