From 2542900df2dd164ffeae20327e58d2dde8d50816 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Sun, 25 Feb 2018 18:40:10 +0100 Subject: [PATCH] Add cron for cryptoportfolio bot --- modules/role/manifests/cryptoportfolio.pp | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) 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) { -- 2.41.0