From a1a294669e13a0dee28c6139034a96d2abea41c1 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 1 Dec 2017 15:46:42 +0100 Subject: [PATCH] R packages updater: do not overlap the upgrade and install runs. Fix the job that kills old instances. --- R/tasks/r-packages-updater.yml | 4 ++-- R/templates/update_r_packages.sh.j2 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/tasks/r-packages-updater.yml b/R/tasks/r-packages-updater.yml index 2f09fd98..942e59b8 100644 --- a/R/tasks/r-packages-updater.yml +++ b/R/tasks/r-packages-updater.yml @@ -7,10 +7,10 @@ file: dest={{ r_packages_svn_base_dir }} state=directory - name: Cron job that installs new R packages, if any - cron: name="install new R packages" user=root cron_file=install-r-packages minute="*/10" job="/usr/local/bin/update_r_packages install >/var/log/install_r_packages 2>&1" state=present + cron: name="install new R packages" user=root cron_file=install-r-packages minute="*/10" hour="5-0,1-2" job="/usr/local/bin/update_r_packages install >/var/log/install_r_packages 2>&1" state=present - name: Cron job that upgrades existing R packages and installs new ones, if any - cron: name="install new R packages" user=root cron_file=upgrade-r-packages hour="3" job="/usr/local/bin/update_r_packages upgrade >/var/log/update_r_packages 2>&1" state=present + cron: name="install new R packages" user=root cron_file=upgrade-r-packages minute="7" hour="3" job="/usr/local/bin/update_r_packages upgrade >/var/log/update_r_packages 2>&1" state=present when: r_packages_updater tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater' ] diff --git a/R/templates/update_r_packages.sh.j2 b/R/templates/update_r_packages.sh.j2 index 91e42ba7..4964943c 100644 --- a/R/templates/update_r_packages.sh.j2 +++ b/R/templates/update_r_packages.sh.j2 @@ -75,7 +75,7 @@ function fail() { function init_env() { if [ -f $LOCK_FILE ] ; then OLDPROC=$( cat $LOCK_FILE ) - OLDPROC_RUNNING=$( ps auwwx | grep -v grep | grep $OLDPROC ) + OLDPROC_RUNNING=$( ps auwwx | grep -v grep | grep $OLDPROC | awk '{ print $2 }' ) RETVAL=$? if [ $RETVAL -eq 0 ] ; then logger "update_r_packages: $OLDPROC_RUNNING"