Cómo RSYNC un solo archivo?
Actualmente solo RSync-ing el Directories
como:
* * * * * rsync -avz /var/www/public_html/images root@<remote-ip>:/var/www/public_html
Entonces, ¿cómo puedo rsync
un solo archivo como, /var/www/public_html/.htaccess
?
3 answers
Lo hace de la misma manera que lo haría con un directorio, pero especifica la ruta completa al nombre del archivo como fuente. En su ejemplo:
rsync -avz /var/www/public_html/.htaccess root@<remote-ip>:/var/www/public_html/
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-02-23 11:06:41
Sintaxis básica
rsync options source destination
Ejemplo
rsync -az /var/www/public_html/filename root@<remote-ip>:/var/www/public_html
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-03-05 17:49:06
La respuesta de Michael Place funciona muy bien si, en relación con el directorio raíz tanto para el origen como para el destino, todos los directorios en la ruta del archivo ya existen.
Pero qué pasa si desea sincronizar un archivo con esta ruta de origen:
/source-root/a / b / file
A un archivo con la siguiente ruta de destino:
/target-root/a / b / file
Y los directorios un y b no existe?
Necesita ejecutar un comando rsync como lo siguiente:
rsync -r --include="/a/" --include="/a/b/" --include="/a/b/file" --exclude="*" [source] [target]
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-08-16 18:50:47