Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/linkchecker.sh

    r27 r2  
    22# 
    33# module : 
    4 # check links of acmo before and after installation 
     4# check links of bibnemomaf before and after installation 
    55# cf. install.sh 
    66# 
    77# original location : 
    8 # /usr/home/fplod/locean/acmo/doc/linkchecker.sh sur aedon.locean-ipsl.upmc.fr 
     8# /usr/home/fplod/incas/bibnemo/src/bibnemomaf/linkchecker.sh sur aedon.locean-ipsl.upmc.fr 
    99# 
    10 # update : 
    11 # ++ linkchecker ne voit pas les erreurs !! 
    12 # ++ dirpublish forme fplod@cerbere.locean-ipsl.upmc.fr:./WWW/ par example 
    13 # donc pas http 
    14 # + ajouter la possibilite rde faire une carte du site avec 
    15 # graphiz 
    16 # exemple synatxe = 
    17 # $ linkchecker -odot -v http://www.lodyc.jussieu.fr/NEMO/general/biblio_new/   | dot -Tps > sitemap.ps 
     10# update :: 
     11# fplod 2007-04-04T14:09:58Z aedon.locean-ipsl.upmc.fr (Darwin) 
     12# creation 
    1813# 
    19 # remove "set -u" because I don't know how to test if there is at least 
    20 # one directory AND one url to be checked without this option 
    21 # !! ++ must be restore ASAP 
    22 # fplod 2007-10-12T07:32:08Z aedon.locean-ipsl.upmc.fr (Darwin) 
    23 # add -u pour url 
    24 # add multiple -d and suppression of interactivity 
    25 # replace -w by -d (more generic) 
    26 # use rather checklink than linkchecker because the first one exist either 
    27 # on Mac and Unix, and because the second one exists only on Mac and 
    28 # does'nt seem to detect every problem 
    29 # fplod 2007-10-11T15:31:25Z aedon.locean-ipsl.upmc.fr (Darwin) 
    30 # parametrization 
    31 # merge with checklink.sh ++ choisir entre les deux 
    32 # fplod 2007-06-19T09:26:04Z aedon.locean-ipsl.upmc.fr (Darwin) 
    33 # création 
     14set -u 
     15set -o posix 
     16command=$(basename ${0}) 
    3417# 
    35 set -o posix 
    36 command=$(basename ${0} .sh) 
    37 log_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") 
    38 log=/tmp/${command}.log.${log_date} 
     18# ++ simu paramètre 
     19DIRWWW=/usr/temp/${LOGNAME}/public_html/bibnemomaf/ 
    3920# 
    40 usage=" Usage : ${command} -d dircheck -u url" 
     21linkcheckeropt="--anchors --recursion-level=-1" 
    4122# 
    42 minargcount=2 
    43 #echo " narg ${#}" 
    44 if [ ${#} -lt ${minargcount} ] 
     23# test if linkchecker is available 
     24type linkchecker 1> /dev/null 2>&1 
     25status=${?} 
     26if [ ${status} -ne 0 ] 
    4527then 
    46   echo "eee : not enought arguments" 
    47   echo "${usage}" 
    48   exit 1 
     28 echo " eee : linkchecker not found" 
     29 exit 1 
    4930fi 
    5031# 
    51 idircheck=0 
    52 iurl=0 
    53 while [ ! -z "${1}" ] 
    54 do 
    55  case ${1} in 
    56  -d) 
    57   idircheck=$(( ${idircheck} + 1 )) 
    58   dircheck[${idircheck}]=${2} 
    59   shift 
     32echo " " 
     33#++fverif=${DIRWWW}/en/one/bibnemomaf00.html 
     34fverif="file://"${DIRWWW}/en/one/bibnemomaf00.html 
     35nverif=wwwone00 
     36echo " Do you want to check ${fverif} (y|[n]) ?" 
     37anwser=" " 
     38read anwser 
     39case ${anwser} in 
     40 y|Y) 
     41 log=/tmp/linkchecker${nverif}.log 
     42 err=/tmp/linkchecker${nverif}.err 
     43 echo "iii : check of ${fverif}" 
     44 linkchecker \ 
     45 ${linkcheckeropt} \ 
     46 ${fverif} \ 
     47 1> ${log} 2> ${err} 
     48 echo "iii : log in ${log}" 
    6049 ;; 
    61  -u) 
    62   iurlcheck=$(( ${iurlcheck} + 1 )) 
    63   urlcheck[${iurlcheck}]=${2} 
    64   shift 
     50 *) 
     51 echo "iii : no check of ${fverif}" 
    6552 ;; 
    66  esac 
    67  shift # next flag 
    68 done 
     53esac 
    6954# 
    70 # +++ remove temporarily  
    71 # +++ set -u 
     55echo " " 
     56#++fverif=${DIRWWW}/en/one/bibnemomaf01.html 
     57fverif="file://"${DIRWWW}/en/one/bibnemomaf01.html 
     58nverif=wwwone00 
     59echo " Do you want to check ${fverif} (y|[n]) ?" 
     60anwser=" " 
     61read anwser 
     62case ${anwser} in 
     63 y|Y) 
     64 log=/tmp/linkchecker${nverif}.log 
     65 err=/tmp/linkchecker${nverif}.err 
     66 echo "iii : check of ${fverif}" 
     67 linkchecker \ 
     68 ${linkcheckeropt} \ 
     69 ${fverif} \ 
     70 1> ${log} 2> ${err} 
     71 echo "iii : log in ${log}" 
     72 ;; 
     73 *) 
     74 echo "iii : no check of ${fverif}" 
     75 ;; 
     76esac 
    7277# 
    73 # ++ check directories or URL 
    74 # 
    75 # choose the command to be used 
    76 # 
    77 commandcheck=checklink 
    78 # 
    79 if [ ${commandcheck} = "linkchecker" ] 
    80 then 
    81    # test if linkchecker is available 
    82    type ${commandcheck} 1> /dev/null 2>&1 
    83    status=${?} 
    84    if [ ${status} -ne 0 ] 
    85    then 
    86     echo "${command} : eee : ${commandcheck} unavailable" 
    87     exit 1 
    88    fi 
    89    optcheck="--anchors --recursion-level=-1" 
    90 fi 
    91 # 
    92 if [ ${commandcheck} = "checklink" ] 
    93 then 
    94    # test if checklink is available 
    95    type ${commandcheck} 1> /dev/null 2>&1 
    96    status=${?} 
    97    if [ ${status} -ne 0 ] 
    98    then 
    99       echo "${command} : eee : ${commandcheck} unavailable" 
    100       exit 1 
    101    fi 
    102 # 
    103    optcheck="--summary --recursive" 
    104 fi 
    105 # 
    106 # loop on directories to be checked 
    107 dirchecksize=${#dircheck[@]} # ++ pb set -u 
    108 if [ ${dirchecksize} -gt 0 ] 
    109 then 
    110    idircheck=1 
    111    while [ ${idircheck} -le ${dirchecksize} ] 
    112    do 
    113       echo "iii : beginning of check of ${dircheck[${idircheck}]}" 1>>${log} 
    114       fverif="file://"${dircheck[${idircheck}]} 
    115       echo "iii : check of ${fverif}" 
    116       ${commandcheck} ${optcheck} ${fverif} 1>>${log} 2>&1 
    117       idircheck=$(( ${idircheck} + 1 )) 
    118    done 
    119 fi 
    120 # 
    121 # loop on urls to be checked 
    122 urlchecksize=${#urlcheck[@]} # ++ pb set -u 
    123 if [ ${urlchecksize} -gt 0 ] 
    124 then 
    125    iurlcheck=1 
    126    while [ ${iurlcheck} -le ${urlchecksize} ] 
    127    do 
    128       echo "iii : beginning of check of ${urlcheck[${iurlcheck}]}" 1>>${log} 
    129       # ++ test si urlcheck commence par http ou pas 
    130       fverif=${urlcheck[${iurlcheck}]} 
    131       echo "iii : check of ${fverif}" 
    132       ${commandcheck} ${optcheck} ${fverif} 1>>${log} 2>&1 
    133       iurlcheck=$(( ${iurlcheck} + 1 )) 
    134    done 
    135 fi 
    136 # 
    137 echo "iii : log in ${log}" 
    138 # end 
    13978exit 
Note: See TracChangeset for help on using the changeset viewer.