Pokazywanie postów oznaczonych etykietą rsync. Pokaż wszystkie posty
Pokazywanie postów oznaczonych etykietą rsync. Pokaż wszystkie posty

sobota, 14 października 2017

Watchman - How to automatically copy modified files to the docker container

Watchman package is a really great tool but requires a while to understand its magic. To install it just type
$ brew install watchman
In 4.9 version it comes with three commands:
  • watchman
  • watchman-wait
  • watchman-make

The latter two are just utilities under the first one.

Lets focus on watchman itself and one of its outstanding feature called triggers. Actually, it is what it sounds to be - a mechanism that causes invoking given action on a given event happened (for example copying file to the remote server once it appear in certain folder)

Watchman Trigger Examples

Copying js files
 watchman -- trigger $PWD cr '**/*.js' '**/*.css' '**/*.html' '**/*.php' -- sh push.sh
Which basically causes all js, css, html and php files from the current folder are passed to push.sh script.

Push.sh script can look like this:

for i in $@
do
 docker cp $i centrum:/var/www/html/$i
done

niedziela, 25 stycznia 2015

How to use rsync to synchronize two folders without overriding permissions

Very popular and easy to remeber rsync command is rsync -a source_dir target_dir . "-a" is equivalent of "-rlptgoD". What does it mean?? Let's analyze it step by step.
  • "-r" - reqursive
  • "-l" - copy symbolic links as symbolic links
  • "-p" - preserve permessions
  • "-t" - preserve modification dates
  • "-g" - preserve group
  • "-o" - preserve owner (works only with root account)
  • "-D" - preserve device files and special files
So to do the same as "-a" does we need to ommit "-p" switch.
rsync -rltgoD m/bdg .

wtorek, 13 stycznia 2015

Rsync - ERROR: rsync error: protocol incompatibility (code 2) at compat.c(171) [sender=3.0.6]

$rsync -av file.zip user@host:file.zip
protocol version mismatch -- is your shell clean?
(see the rsync man page for an explanation)
rsync error: protocol incompatibility (code 2) at compat.c(171) [sender=3.0.6]
This message can be somewhat misleading at first glance, but the key to solve this issue is answering what actually means "clean shell" ;). Most probably there is some MOTD (message of the day) displayed in one of the config files (eg. .bashrc) when user starts a new session. To check if it is the case, try the following command:

ssh designer@10.1.1.162 true | wc -c
If this command returns more then 0 that means there is some output produced. Get rid of it should fix it.