]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/commitdiff
Add cron for cryptoportfolio bot
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 25 Feb 2018 17:40:10 +0000 (18:40 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 25 Feb 2018 17:46:30 +0000 (18:46 +0100)
modules/role/manifests/cryptoportfolio.pp

index 32b4391d482ab3f81e48ed6b371a54d851306bb2..ee1c74f10f36a06a0d0ca71a00d462e09b7dfb24 100644 (file)
@@ -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) {