diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-02-25 18:40:10 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-02-25 18:46:30 +0100 |
commit | 2542900df2dd164ffeae20327e58d2dde8d50816 (patch) | |
tree | fce08620bbff2801f6a5e0d1391db73b306d0037 | |
parent | 7e29a2ae7ea175fd2e84d6149c94df384bc1ba85 (diff) | |
download | Puppet-2542900df2dd164ffeae20327e58d2dde8d50816.tar.gz Puppet-2542900df2dd164ffeae20327e58d2dde8d50816.tar.zst Puppet-2542900df2dd164ffeae20327e58d2dde8d50816.zip |
Add cron for cryptoportfolio bot
-rw-r--r-- | modules/role/manifests/cryptoportfolio.pp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/role/manifests/cryptoportfolio.pp b/modules/role/manifests/cryptoportfolio.pp index 32b4391..ee1c74f 100644 --- a/modules/role/manifests/cryptoportfolio.pp +++ b/modules/role/manifests/cryptoportfolio.pp | |||
@@ -216,6 +216,11 @@ class role::cryptoportfolio { | |||
216 | command => "/usr/bin/make install", | 216 | command => "/usr/bin/make install", |
217 | require => User[$cf_user], | 217 | require => User[$cf_user], |
218 | refreshonly => true, | 218 | refreshonly => true, |
219 | before => [ | ||
220 | File[$cf_bot_app_conf], | ||
221 | Cron["py-cryptoportfolio-before"], | ||
222 | Cron["py-cryptoportfolio-after"], | ||
223 | ] | ||
219 | } | 224 | } |
220 | 225 | ||
221 | file { $cf_bot_app_conf: | 226 | file { $cf_bot_app_conf: |
@@ -224,6 +229,33 @@ class role::cryptoportfolio { | |||
224 | mode => "0600", | 229 | mode => "0600", |
225 | content => template("role/cryptoportfolio/bot_config.ini.erb") | 230 | content => template("role/cryptoportfolio/bot_config.ini.erb") |
226 | } | 231 | } |
232 | |||
233 | cron { "py-cryptoportfolio-before": | ||
234 | ensure => present, | ||
235 | command => "cd $cf_bot_app ; python main.py --config $cf_bot_app_conf --before", | ||
236 | user => "cryptoportfolio", | ||
237 | weekday => 7, # Sunday | ||
238 | hour => 22, | ||
239 | minute => 30, | ||
240 | environment => ["HOME=${cf_home}","PATH=/usr/bin/"], | ||
241 | require => [ | ||
242 | File[$cf_bot_app_conf], | ||
243 | Archive["${cf_home}/${bot_version}.tar.gz"] | ||
244 | ], | ||
245 | } | ||
246 | |||
247 | cron { "py-cryptoportfolio-after": | ||
248 | ensure => present, | ||
249 | command => "cd $cf_bot_app ; python main.py --config $cf_bot_app_conf --after", | ||
250 | user => "cryptoportfolio", | ||
251 | weekday => 1, # Monday | ||
252 | hour => 1, | ||
253 | environment => ["HOME=${cf_home}","PATH=/usr/bin/"], | ||
254 | require => [ | ||
255 | File[$cf_bot_app_conf], | ||
256 | Archive["${cf_home}/${bot_version}.tar.gz"] | ||
257 | ], | ||
258 | } | ||
227 | } | 259 | } |
228 | 260 | ||
229 | unless empty($front_version) { | 261 | unless empty($front_version) { |