Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Pondelok, 25. máj 2026

Rozdiely pre scripts/php/sk-nic/download.sh medzi verziami 1.13 a 1.14

verzia 1.13, 2017/09/18 10:15:38 verzia 1.14, 2017/09/23 09:30:13
Riadok 11 
Riadok 11 
 # Changelog:  # Changelog:
 # 2006-08-13 - created  # 2006-08-13 - created
 # 2017-09-12 - implemented new SK-NIC-EPP/CentralNic export  # 2017-09-12 - implemented new SK-NIC-EPP/CentralNic export
   # 2017-09-23 - added support for multiple imports: domains, registrars
 #  #
   
 # $Platon: scripts/php/sk-nic/download.sh,v 1.12 2017/09/16 09:36:22 nepto Exp $  # $Platon: scripts/php/sk-nic/download.sh,v 1.13 2017/09/18 10:15:38 nepto Exp $
   
 #  #
 # Put this into your crontab, it will run this script every morning at 6:15 am:  # Put this into your crontab, it will run this script every morning at 6:15 am:
Riadok 23 
Riadok 24 
 # NOTE: you will probably need to alter the script path  # NOTE: you will probably need to alter the script path
 #  #
   
 PROCESS_FILE="$1";  
 PREFIX="SK-NIC";  PREFIX="SK-NIC";
 PREFIX_ERR="$PREFIX-ERROR";  PREFIX_ERR="$PREFIX-ERROR";
 INPUT_FILE="https://sk-nic.sk/subory/domains.txt";  PREFIX_INFO="$PREFIX-INFO";
 OUTPUT_FILE="data-new/sk-nic.`date '+%F'`.csv";  
 WORK_FILE="domains-work-file.csv";  
 WGET="`which wget`";  
 PHP="`which php`";  PHP="`which php`";
   WGET="`which wget`";
   
   if [ -z "$1" ]; then
           echo "Usage: `basename \"$0\"` <type_or_file1> [ <type_or_file2> ]";
           exit 1;
   fi
   
 work_dir="`dirname $0`";  work_dir="`dirname $0`";
 if [ "X$work_dir" = "X" ]; then  if [ "X$work_dir" = "X" ]; then
         echo "$PREFIX_ERR: empty work directory variable";          echo "$PREFIX_ERR: empty work directory variable";
         exit 1;          exit 2;
 fi;  fi;
   
 cd "$work_dir";  cd "$work_dir";
 if [ "$?" -ne 0 ]; then  if [ "$?" -ne 0 ]; then
         echo "$PREFIX_ERR: unable to change directory";          echo "$PREFIX_ERR: unable to change directory";
         exit 2;          exit 3;
 fi;  fi;
   
 # if no file provided, download one from www.sk-nic.sk  if [ -z "$PHP" ]; then
 if [ -z "$PROCESS_FILE" ]; then          echo "$PREFIX_ERR: php binary not found, no import was done";
         if [ -z "$WGET" ]; then          exit 4;
                 echo "$PREFIX_ERR: wget binary not found";  fi;
                 exit 3;  
         fi;  
         if [ -s "$OUTPUT_FILE" ]; then  
                 echo "$PREFIX_ERR: file already exists: $OUTPUT_FILE";  
                 exit 4;  
         fi;  
   
         $WGET --quiet -O "$OUTPUT_FILE" --no-check-certificate "$INPUT_FILE";  
         rc="$?";  
   
         if [ "$rc" -eq 8 ]; then  for PROCESS_FILE in "$@"; do
                 echo "$PREFIX_ERR: error 404 Not Found - repeat download";  
                 exit "$rc";          # if file type is provided, download one from www.sk-nic.sk
         elif [ "$rc" -ne 0 ]; then          if [ "$PROCESS_FILE" = "domains" -o "$PROCESS_FILE" = "registrars" ]; then
                 echo "$PREFIX_ERR: fetch error (wget_exit:$rc; wget_bin:$WGET)";                  INPUT_FILE="https://sk-nic.sk/subory/$PROCESS_FILE"".txt";
                 exit "$rc";                  OUTPUT_FILE="data-new/$PROCESS_FILE"".`date '+%F'`.txt";
         fi;  
                   if [ -z "$WGET" ]; then
         if [ \! -s "$OUTPUT_FILE" ]; then                          echo "$PREFIX_ERR: wget binary not found";
                 echo "$PREFIX_ERR: file $OUTPUT_FILE was downloaded, but it is empty";                          exit 5;
                 exit 5;                  fi;
                   if [ -s "$OUTPUT_FILE" ]; then
                           echo "$PREFIX_ERR: file already exists: $OUTPUT_FILE";
                           exit 6;
                   fi;
   
                   echo "$PREFIX_INFO: fetching $INPUT_FILE";
                   echo "$PREFIX_INFO: into destination file $OUTPUT_FILE";
   
                   $WGET --quiet -O "$OUTPUT_FILE" --no-check-certificate "$INPUT_FILE";
                   rc="$?";
   
                   if [ "$rc" -eq 8 ]; then
                           echo "$PREFIX_ERR: error 404 Not Found - repeat download";
                           exit "$rc";
                   elif [ "$rc" -ne 0 ]; then
                           echo "$PREFIX_ERR: fetch error (wget_exit:$rc; wget_bin:$WGET)";
                           exit "$rc";
                   fi;
   
                   PROCESS_FILE="$OUTPUT_FILE";
           else
                   echo "$PREFIX_INFO: using provided file: $PROCESS_FILE";
         fi          fi
   
         PROCESS_FILE="$OUTPUT_FILE";          if [ \! -r "$PROCESS_FILE" ]; then
 fi                          echo "$PREFIX_ERR: file $PROCESS_FILE not found or not readable";
                           exit 7;
           fi
   
 if [ -z "$PHP" ]; then          if [ \! -s "$PROCESS_FILE" ]; then
         echo "$PREFIX_ERR: php binary not found, no import was done";                  echo "$PREFIX_ERR: file $PROCESS_FILE is empty";
         exit 6;                  exit 8;
 fi;          fi
   
 # and now real import          # and now real import
 $PHP sk-nic.php "$PROCESS_FILE"          $PHP sk-nic.php "$PROCESS_FILE"
 rc="$?";          rc="$?";
 if [ "$rc" -ne 0 ]; then          if [ "$rc" -ne 0 ]; then
         echo "ERROR: return code from sk-nic.php: $rc" >/dev/stderr;                  echo "ERROR: return code from sk-nic.php: $rc" >/dev/stderr;
         exit $rc;                  exit $rc;
 fi          fi
   
   done
   
 #echo "THESE FILES WAS DELETED BY AUTOMATED PROCESS:";  #echo "THESE FILES WAS DELETED BY AUTOMATED PROCESS:";
 #echo "---------------------------------------------";  #echo "---------------------------------------------";

Legend:
Odstranené z verzie1.13  
zmenené riadky
  Pridané vo verzii1.14

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok