diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-26 00:41:55 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-26 01:19:39 +0200 |
commit | 2859008efe8f0a75344c7ba1c9c6e4d589f92da3 (patch) | |
tree | bb48fa503b6b1e01f9216d9e1729e1ba26adacf5 /modules/role | |
parent | 7f1244c8c2a418ed9e978f098c73f8697e2cd306 (diff) | |
download | Puppet-2859008efe8f0a75344c7ba1c9c6e4d589f92da3.tar.gz Puppet-2859008efe8f0a75344c7ba1c9c6e4d589f92da3.tar.zst Puppet-2859008efe8f0a75344c7ba1c9c6e4d589f92da3.zip |
Use external module for cronjobs
Diffstat (limited to 'modules/role')
-rw-r--r-- | modules/role/manifests/backup.pp | 2 | ||||
-rw-r--r-- | modules/role/manifests/cryptoportfolio/bot.pp | 40 |
2 files changed, 20 insertions, 22 deletions
diff --git a/modules/role/manifests/backup.pp b/modules/role/manifests/backup.pp index 7a0c275..510a8ef 100644 --- a/modules/role/manifests/backup.pp +++ b/modules/role/manifests/backup.pp | |||
@@ -41,7 +41,7 @@ class role::backup ( | |||
41 | mode => "0755", | 41 | mode => "0755", |
42 | } | 42 | } |
43 | 43 | ||
44 | cron { "backup": | 44 | cron::job { "backup": |
45 | ensure => present, | 45 | ensure => present, |
46 | command => $backup_script, | 46 | command => $backup_script, |
47 | user => $user, | 47 | user => $user, |
diff --git a/modules/role/manifests/cryptoportfolio/bot.pp b/modules/role/manifests/cryptoportfolio/bot.pp index d8b377f..7b62ae0 100644 --- a/modules/role/manifests/cryptoportfolio/bot.pp +++ b/modules/role/manifests/cryptoportfolio/bot.pp | |||
@@ -37,8 +37,7 @@ class role::cryptoportfolio::bot inherits role::cryptoportfolio { | |||
37 | refreshonly => true, | 37 | refreshonly => true, |
38 | before => [ | 38 | before => [ |
39 | File[$cf_bot_app_conf], | 39 | File[$cf_bot_app_conf], |
40 | Cron["py-cryptoportfolio-before"], | 40 | Cron::Job::Multiple["py-cryptoportfolio"], |
41 | Cron["py-cryptoportfolio-after"], | ||
42 | ] | 41 | ] |
43 | } | 42 | } |
44 | 43 | ||
@@ -54,31 +53,30 @@ class role::cryptoportfolio::bot inherits role::cryptoportfolio { | |||
54 | ], | 53 | ], |
55 | } | 54 | } |
56 | 55 | ||
57 | cron { "py-cryptoportfolio-before": | 56 | cron::job::multiple { "py-cryptoportfolio": |
58 | ensure => present, | 57 | ensure => present, |
59 | command => "cd $cf_bot_app ; python main.py --quiet --config $cf_bot_app_conf --before", | ||
60 | user => $user, | ||
61 | weekday => 7, # Sunday | ||
62 | hour => 22, | ||
63 | minute => 30, | ||
64 | environment => ["HOME=${home}","PATH=/usr/bin/","CRON_TZ=UTC"], | 58 | environment => ["HOME=${home}","PATH=/usr/bin/","CRON_TZ=UTC"], |
65 | require => [ | 59 | require => [ |
66 | File[$cf_bot_app_conf], | 60 | File[$cf_bot_app_conf], |
67 | Archive["${home}/trader_${bot_version}.tar.gz"] | 61 | Archive["${home}/trader_${bot_version}.tar.gz"] |
68 | ], | 62 | ], |
69 | } | 63 | jobs => [ |
70 | 64 | { | |
71 | cron { "py-cryptoportfolio-after": | 65 | command => "cd $cf_bot_app ; python main.py --quiet --config $cf_bot_app_conf --before", |
72 | ensure => present, | 66 | user => $user, |
73 | command => "cd $cf_bot_app ; python main.py --quiet --config $cf_bot_app_conf --after", | 67 | weekday => 7, # Sunday |
74 | user => $user, | 68 | hour => 22, |
75 | weekday => 1, # Monday | 69 | minute => 30, |
76 | hour => 0, | 70 | description => "Run before the cryptoportfolio update", |
77 | minute => 0, | 71 | }, |
78 | environment => ["HOME=${home}","PATH=/usr/bin/","CRON_TZ=UTC"], | 72 | { |
79 | require => [ | 73 | command => "cd $cf_bot_app ; python main.py --quiet --config $cf_bot_app_conf --after", |
80 | File[$cf_bot_app_conf], | 74 | user => $user, |
81 | Archive["${home}/trader_${bot_version}.tar.gz"] | 75 | weekday => 1, # Monday |
76 | hour => 0, | ||
77 | minute => 0, | ||
78 | description => "Run after the cryptoportfolio update", | ||
79 | } | ||
82 | ], | 80 | ], |
83 | } | 81 | } |
84 | 82 | ||