Я пытаюсь создать зеркало сайта, которым я управляю, в целях резервного копирования.
Вот моя команда wget:
wget \
--mirror \ # Download the whole site, updating local files as needed.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
--backup-converted \ # Backup original HTML files before converting links
--restrict-file-names=windows \ # Modify filenames to work in Windows as well.
--domains=********.*** \ # Do not follow links outside this domain.
--no-parent \ # Don't follow links outside the directory you pass in.
--append-output=wget.log \ # Send output to log file
--rejected-log=wget-rejected.log \ # separate log file for rejected requests
--reject=SwitchToAdmin,SignOut
--show-progress \ # Show progress bar
--random-wait \ # Roandomize wait time (0.5 - 1.5 * wait)
--wait=2 \ # median wait time in seconds
https://********.*** # The URL to download
и вот результаты:
--2021-05-03 14:14:20-- http://%20/
Resolving ( )... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘ ’
--2021-05-03 14:14:20-- http://download/
Resolving download (download)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘download’
--2021-05-03 14:14:20-- http://the/
Resolving the (the)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘the’
--2021-05-03 14:14:20-- http://whole/
Resolving whole (whole)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘whole’
--2021-05-03 14:14:20-- http://site,/
Resolving site, (site,)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘site,’
--2021-05-03 14:14:20-- http://updating/
Resolving updating (updating)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘updating’
--2021-05-03 14:14:20-- http://local/
Resolving local (local)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘local’
--2021-05-03 14:14:20-- http://files/
Resolving files (files)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘files’
--2021-05-03 14:14:20-- http://as/
Resolving as (as)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘as’
--2021-05-03 14:14:20-- http://needed./
Resolving needed. (needed.)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘needed.’
wget.sh: line 9: syntax error near unexpected token `('
wget.sh: line 9: ` --page-requisites \ # Get all assets/elements (CSS/JS/images).'
Почему wget пытается получить доступ к http: //, когда я просил его открыть https: //?
В bash, \
используется для экранирования следующего символа.
Часто используется (и, вероятно, это то, что вам нужно), чтобы экранировать символ новой строки , чтобы включить многострочную команду.
wget \
-arg1 \
-arg2
Если вы хотите, чтобы \
экранировал символ новой строки, он должен быть помещен непосредственно перед ним, иначе это не сработает:
wget \ # some comment
-arg1 \
-arg2
... экранирует пробел и следующее будет выполнено (проверьте set -x
):
+ wget ' #' some comment
Кроме того, поскольку ваша следующая строка (строки) больше не связаны, вы, скорее всего, получите сообщение об ошибке вроде:
`-arg1`: command not found.