#!/bin/sh # # module : # publication (rsync) of dirwww content on dirpublish given in argument # # If the host of publication is cerbere.locean-ipsl.upmc.fr, a specific update # is launched. # # update : # $Id$ # ++ -p should be suppress it is not any more compulsary (-u is now the good one) # fplod 2008-03-28T10:26:58Z aedon.locean-ipsl.upmc.fr (Darwin) # new personnal webpages policy at LOCEAN so new command and new parameter (-u) # fplod 2007-09-28T09:30:43Z aedon.locean-ipsl.upmc.fr (Darwin) # parametrisation and translation # smasson 2007-06-07T16:43:42Z arete.locean-ipsl.upmc.fr (Darwin) # can give the answer with input parameters # fplod 2007-04-26T11:51:42Z aedon.locean-ipsl.upmc.fr (Darwin) # set -o posix command=$(basename ${0} .sh) log_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") log=/tmp/${command}.${log_date} # usage=" Usage : ${command} -w dirwww -p dirpublish -u urlpublish" # minargcount=4 #echo " narg ${#}" if [ ${#} -lt ${minargcount} ] then echo "eee : not enought arguments" echo "${usage}" exit 1 fi # # default dirpublish="none" urlpublish="none" # while [ ! -z "${1}" ] do case ${1} in -w) dirwww=${2} shift ;; -p) dirpublish=${2} shift ;; -u ) urlpublish=${2} shift ;; esac shift # next flag done # set -u # # ++ check directories # answer=${1:-" "} case ${answer} in y|Y|n|N) ;; *) if [ "${dirpublish}" != "none" ] then echo "Do you want to install on ${dirpublish} (y|[n]) ?" read answer fi if [ "${urlpublish}" != "none" ] then echo "Do you want to install on ${urlpublish} (y|[n]) ?" read answer fi ;; esac # case ${answer} in y|Y) if [ "${dirpublish}" != "none" ] then # copy of ${dirwww} on $dirpublish echo "iii : update of ${dirpublish}" rsync -av --exclude=".DS_Store" -e ssh ${dirwww}/ ${dirpublish} # detect if in dirpublish following this pattern [USER@]HOST:SRC, HOST # is cerbere.locean-ipsl.upmc.fr. If so, a specific update is launched userhost=${dirpublish%%:*} host=${userhost##*@} user=${userhost%%@*} if [ "${host}" = "cerbere.locean-ipsl.upmc.fr" ] then wget -q "http://www.lodyc.jussieu.fr/info_reseau/persoweb/?fastupdate=1&user=${user}" -O /dev/null fi else # urlpublish=http://www.locean-ipsl.upmc.fr/~ginette/produit dirpublish=${urlpublish##*~} cd ${dirwww} lftp -e "mirror -R . ${dirpublish};quit" -u ${LOGNAME} skyros.locean-ipsl.upmc.fr # ++ log fi ;; *) echo "no update of ${dirpublish} or ${urlpublish}" ;; esac # # normal exit exit 0