summaryrefslogtreecommitdiff
path: root/src/Propellor/Property
diff options
context:
space:
mode:
authorJoey Hess2014-07-17 15:33:02 -0400
committerJoey Hess2014-07-17 15:33:02 -0400
commit79f1a6c67b72b695b23db69aaa606dc79c313d86 (patch)
tree4474cd3c868d13839c90743ad70593bc243a71bc /src/Propellor/Property
parentebb7353f49249967c219ed2aaffd9be8be70e6b8 (diff)
propellor spin
Diffstat (limited to 'src/Propellor/Property')
-rw-r--r--src/Propellor/Property/Cron.hs2
-rw-r--r--src/Propellor/Property/SiteSpecific/JoeySites.hs23
2 files changed, 24 insertions, 1 deletions
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"]