library/roles/R: Fix the packages updater script.

This commit is contained in:
Andrea Dell'Amico 2016-11-11 17:04:17 +01:00
parent f17ef0d2e1
commit f52ef24f84
2 changed files with 7 additions and 5 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" state=present 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
- 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" state=present 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
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' ]
@ -24,10 +24,10 @@
file: dest={{ r_packages_svn_base_dir }} state=absent file: dest={{ r_packages_svn_base_dir }} state=absent
- name: Remove the cron job that installs new R packages - name: Remove the cron job that installs new R packages
cron: name="install new R packages" user=root minute="*/10" cron_file=install-r-packages job="/usr/local/bin/update_r_packages install" state=absent cron: name="install new R packages" user=root minute="*/10" cron_file=install-r-packages job="/usr/local/bin/update_r_packages install >/var/log/install_r_packages 2>&1" state=absent
- name: Remove the cron job that upgrades existing R packages and installs new ones - name: Remove the cron job that upgrades existing R packages and installs new ones
cron: name="install new R packages" user=root cron_file=upgrade-r-packages hour="3" job="/usr/local/bin/update_r_packages upgrade" state=absent 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=absent
when: not r_packages_updater when: not 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

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
export PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
RETVAl= RETVAl=
PARAMS=$# PARAMS=$#
ACTION=$1 ACTION=$1
@ -136,7 +138,7 @@ function debian_pkgs() {
else else
logger "update_r_packages: APT cache not updated" logger "update_r_packages: APT cache not updated"
fi fi
xargs -a <(awk '/^\s*[^#]/' "$PKGS_LIST") -r -- apt-get install -q -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" xargs -a <(awk '/^\s*[^#]/' "$PKGS_LIST") -r -- apt-get install -q -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" >/var/log/update_r_debs.log 2>&1
else else
logger "update_r_packages: skipping the debian packages installation" logger "update_r_packages: skipping the debian packages installation"
fi fi