From bf25888d037b81fe6d002d735a5e008f23a29918 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Fri, 8 Apr 2016 15:53:20 +0200 Subject: [PATCH] nb-update --- bin/nb-update | 9 +++------ etc/cron/nb | 4 ++-- etc/dbs.php | 12 +++++++++++- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/bin/nb-update b/bin/nb-update index f8025df6..94d609dc 100755 --- a/bin/nb-update +++ b/bin/nb-update @@ -19,7 +19,6 @@ ex=0 printf '#!%s\n%s\n' `which sh` 'ssh -o BatchMode=yes $@' > "$TMP" && chmod 755 "$TMP" export GIT_SSH="$TMP" -errors='' for repo in $(nb-repo-dirs); do # NB 17.01.16 # Check dir @@ -48,16 +47,15 @@ for repo in $(nb-repo-dirs); do if [ "$ret" != "0" ]; then ex=$ret && echo ">err $ret" - errors="$errors\n$cmd" else cmd_root="true" [ -x bin/$name-install ] && cmd_root="$cmd_root && echo ' >$name-install' && bin/$name-install|sed 's/^/ /'" #[ "$cmd_root" == "true" ] || eval "$cmd_root" || echo ">err" - if [ "$cmd_root" != "true" ] && ! eval "$cmd_root"; then + if [ "$cmd_root" != "true" ]; then + eval "$cmd_root" ex=$? - echo ">err" - errors="$errors\n$cmd_root" + [ "$ex" -gt "0" ] && echo ">err" fi fi @@ -74,7 +72,6 @@ if [ "$ex" == "0" ]; then printf ">OK\n" else printf ">ERR\n" - [ -n "$errors" ] && printf "$errors" | mail -s "$NAME" -- nico@nbdom.net fi exit $ex diff --git a/etc/cron/nb b/etc/cron/nb index ce84d4fd..a7f55b50 100644 --- a/etc/cron/nb +++ b/etc/cron/nb @@ -8,5 +8,5 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/nb/bin ##################################################################### # m h dom mon dow user command # -*/15 09-23 * * * root nb-update >/var/log/nb.log 2>&1 -0 00-08 * * * root nb-update >/var/log/nb.log 2>&1 +*/15 09-23 * * * root nb-update >/var/log/nb.log 2>&1 || cat /var/log/nb.log +0 00-08 * * * root nb-update >/var/log/nb.log 2>&1 || cat /var/log/nb.log diff --git a/etc/dbs.php b/etc/dbs.php index c82782a8..fc67de09 100644 --- a/etc/dbs.php +++ b/etc/dbs.php @@ -111,8 +111,18 @@ $CONF = array ( 'password' => 'mpc60ax73', 'type' => 'mysql', 'name' => 'nb', + 'default_table' => 'rent', 'tables' => array( - + 'rent' => array( + 'order_by' => 'start desc', + 'replace' => array ( + 'idtenant' => 'tenant.name', + 'idplace' => 'addr.addr', + ), + 'columns' => array ( + 'total' => function(&$r) {$r['rent'] + $r['charge'];} + ), + ), ), ), 'puppetdb' => array ( -- 2.47.3