R packages updater: do not overlap the upgrade and install runs. Fix the job that kills old instances.

This commit is contained in:
Andrea Dell'Amico 2017-12-01 15:46:42 +01:00
parent c143bd9e8e
commit a1a294669e
2 changed files with 3 additions and 3 deletions

View File

@ -7,10 +7,10 @@
file: dest={{ r_packages_svn_base_dir }} state=directory file: dest={{ r_packages_svn_base_dir }} state=directory
- name: Cron job that installs new R packages, if any - 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 - 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 when: r_packages_updater
tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater' ] tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater' ]

View File

@ -75,7 +75,7 @@ function fail() {
function init_env() { function init_env() {
if [ -f $LOCK_FILE ] ; then if [ -f $LOCK_FILE ] ; then
OLDPROC=$( cat $LOCK_FILE ) 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=$? RETVAL=$?
if [ $RETVAL -eq 0 ] ; then if [ $RETVAL -eq 0 ] ; then
logger "update_r_packages: $OLDPROC_RUNNING" logger "update_r_packages: $OLDPROC_RUNNING"