Last change
on this file since 23 was
23,
checked in by pinsard, 17 years ago
|
improvement of before and after tasks parametrization
|
-
Property svn:keywords set to
Id
|
File size:
1.6 KB
|
Rev | Line | |
---|
[2] | 1 | #!/bin/sh |
---|
| 2 | # |
---|
| 3 | # module : |
---|
[23] | 4 | # publication (rsync) of dirwww content on dirpublish given in argument |
---|
[2] | 5 | # |
---|
[23] | 6 | # If the host of publication is cerbere.locean-ipsl.upmc.fr, update_web is |
---|
| 7 | # launched. |
---|
[2] | 8 | # |
---|
| 9 | # update |
---|
[23] | 10 | # $Id$ |
---|
| 11 | # fplod 2007-09-28T09:30:43Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 12 | # parametrisation and translation |
---|
[14] | 13 | # smasson 2007-06-07T16:43:42Z arete.locean-ipsl.upmc.fr (Darwin) |
---|
| 14 | # can give the answer with input parameters |
---|
[2] | 15 | # fplod 2007-04-26T11:51:42Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 16 | # |
---|
[23] | 17 | set -o posix |
---|
| 18 | command=$(basename ${0} .sh) |
---|
| 19 | log_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") |
---|
| 20 | log=/tmp/${command}.${log_date} |
---|
[2] | 21 | # |
---|
[23] | 22 | usage=" Usage : ${command} -w dirwww -p dirpublish" |
---|
| 23 | # |
---|
| 24 | minargcount=4 |
---|
| 25 | echo " narg ${#}" |
---|
| 26 | if [ ${#} -lt ${minargcount} ] |
---|
| 27 | then |
---|
| 28 | echo "eee : not enought arguments" |
---|
| 29 | echo "${usage}" |
---|
| 30 | exit 1 |
---|
| 31 | fi |
---|
| 32 | # |
---|
| 33 | while [ ! -z "${1}" ] |
---|
| 34 | do |
---|
| 35 | case ${1} in |
---|
| 36 | -w) |
---|
| 37 | dirwww=${2} |
---|
| 38 | shift |
---|
[2] | 39 | ;; |
---|
[23] | 40 | -p) |
---|
| 41 | dirpublish=${2} |
---|
| 42 | shift |
---|
[2] | 43 | ;; |
---|
[23] | 44 | esac |
---|
| 45 | shift # next flag |
---|
| 46 | done |
---|
[2] | 47 | # |
---|
[23] | 48 | set -u |
---|
[2] | 49 | # |
---|
[23] | 50 | # ++ check directories |
---|
| 51 | # |
---|
| 52 | answer=${1:-" "} |
---|
[2] | 53 | case ${answer} in |
---|
[14] | 54 | y|Y|n|N) |
---|
| 55 | ;; |
---|
| 56 | *) |
---|
[23] | 57 | echo "Do you want to install on ${dirpublish} (y|[n]) ?" |
---|
| 58 | read answer |
---|
[14] | 59 | ;; |
---|
| 60 | esac |
---|
| 61 | case ${answer} in |
---|
[2] | 62 | y|Y) |
---|
[23] | 63 | # copy of ${dirwww} on $dirpublish |
---|
| 64 | echo "iii : update of ${dirpublish}" |
---|
| 65 | rsync -av -e ssh ${dirwww}/ ${dirpublish} |
---|
| 66 | # detect if in dirpublish following this pattern [USER@]HOST:SRC, HOST |
---|
| 67 | # is cerbere.locean-ipsl.upmc.fr. If so, update_web is launched |
---|
| 68 | userhost=${dirpublish%%:*} |
---|
| 69 | host=${userhost##*@} |
---|
| 70 | if [ "${host}" = "cerbere.locean-ipsl.upmc.fr" ] |
---|
| 71 | then |
---|
| 72 | ssh ${userhost} /usr/local_linux/bin/update_web |
---|
| 73 | fi |
---|
[2] | 74 | ;; |
---|
| 75 | *) |
---|
[23] | 76 | echo "no update of ${dirpublish}" |
---|
[2] | 77 | ;; |
---|
| 78 | esac |
---|
| 79 | # |
---|
| 80 | # normal exit |
---|
| 81 | exit 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.