From: Ismaƫl Bouya Date: Sun, 25 Feb 2018 17:40:10 +0000 (+0100) Subject: Add cron for cryptoportfolio bot X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FPuppet.git;a=commitdiff_plain;h=2542900df2dd164ffeae20327e58d2dde8d50816 Add cron for cryptoportfolio bot --- 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 { command => "/usr/bin/make install", require => User[$cf_user], refreshonly => true, + before => [ + File[$cf_bot_app_conf], + Cron["py-cryptoportfolio-before"], + Cron["py-cryptoportfolio-after"], + ] } file { $cf_bot_app_conf: @@ -224,6 +229,33 @@ class role::cryptoportfolio { mode => "0600", content => template("role/cryptoportfolio/bot_config.ini.erb") } + + cron { "py-cryptoportfolio-before": + ensure => present, + command => "cd $cf_bot_app ; python main.py --config $cf_bot_app_conf --before", + user => "cryptoportfolio", + weekday => 7, # Sunday + hour => 22, + minute => 30, + environment => ["HOME=${cf_home}","PATH=/usr/bin/"], + require => [ + File[$cf_bot_app_conf], + Archive["${cf_home}/${bot_version}.tar.gz"] + ], + } + + cron { "py-cryptoportfolio-after": + ensure => present, + command => "cd $cf_bot_app ; python main.py --config $cf_bot_app_conf --after", + user => "cryptoportfolio", + weekday => 1, # Monday + hour => 1, + environment => ["HOME=${cf_home}","PATH=/usr/bin/"], + require => [ + File[$cf_bot_app_conf], + Archive["${cf_home}/${bot_version}.tar.gz"] + ], + } } unless empty($front_version) {