#!/bin/sh #------------------------------------------------------------------------------ # /var/install/bin/carddav2fb-cronjob-cmd - Cronjob command # # Copyright (c) 2015-2020 The Eisfair Team, team(at)eisfair(dot)org # # Creation: 2016-06-23 jed # Last Update: $Id$ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #------------------------------------------------------------------------------ # read eislib . /var/install/include/eislib pgmname=`basename $0` module_name="`echo "${pgmname}" | cut -d- -f1 | cut -d. -f1`" # debug mode true/false #debug=true if ${debug:-false} then exec 2> /tmp/${pgmname}-trace$$.log set -x ask_debug=true export ask_debug fi configfile=/etc/config.d/${module_name} carddav2fb_runpath=/var/lib/${module_name} carddav2fb_bin=/usr/lib/${module_name}/${module_name} carddav2fb_config="${carddav2fb_runpath}/config`echo "${module_name}" | sed -r 's/^.{7}//'`.php" logfile=/var/log/${module_name}-output-trace.log if [ -f ${configfile} ] then . ${configfile} if [ "${START_CARDDAV2FB}" = 'yes' ] then rm -f ${logfile} # check if custom vcf files exist which should be imported too carddav2fb_options='--image' for VCF in `find ${carddav2fb_runpath} -maxdepth 1 -name "*\.vcf" | grep "^${carddav2fb_runpath}/custom-"` do if [ -s ${VCF} ] then carddav2fb_options="${carddav2fb_options} --local=${VCF}" fi done # run transfer command { echo echo "date : ${EISDATE} ${EISTIME}" echo "command: ${carddav2fb_bin} run --config=${carddav2fb_config} ${carddav2fb_options}" echo } >> ${logfile} ${carddav2fb_bin} run --config=${carddav2fb_config} ${carddav2fb_options} 2>> ${logfile} >> ${logfile} ### THE FOLLOWING ERROR MANAGING NEED TO BE CHECKED !! ### # check if an error has been reported grep -E -i -q "ERROR:|WARNING:" ${logfile} if [ $? -eq 0 ] then grep -E -i "ERROR:|WARNING:" ${logfile} | \ grep -E -v -i "Warning: ftp_close\(\): SSL_read on shutdown: Connection reset by peer|WARNING: You have .* contact images on FritzBox. FritzFon may handle only up to 150 images." | sed 's/^ *//' fi fi else echo "Error: Configuration file '${configfile}' doesn't exist!" fi exit 0