If you want to compare two directories using rsync.
rsync -avun $SOURCE $TARGET # content checsum check rsync -avnc $SOURCE $TARGET
source: StackExchange
If you want to compare two directories using rsync.
rsync -avun $SOURCE $TARGET # content checsum check rsync -avnc $SOURCE $TARGET
source: StackExchange
Some time ago I’ve been moving from one hosting provider to another. I had to transfer the files from A to B and used rsync for that. But unfortunately rsync command was crashing due to some timeouts. So I’ve found really nice script for auto restore.
#!/bin/bash while [ 1 ] do /usr/bin/rsync -avz --progress $1 $2 if [ "$?" = "0" ] ; then echo "rsync completed normally" exit else echo "Rsync failure. Backing off and retrying..." sleep 10 fi done
rsync-auto.sh SOURCE DESTINATION
source: stackoverflow.com
If you want to have nice output colouring of your PHP scripts or those from Symfony Console, you should install POSIX extension to your PHP version.
sudo port install php56-posix
So, you have to use SFTP in your console? Very good article!
$ wget \ --recursive \ --no-clobber \ --page-requisites \ --html-extension \ --convert-links \ --restrict-file-names=windows \ --domains website.org \ --no-parent \ www.website.org/tutorials/html/
source: Linux Journal
Sometimes you have to remove directories from your VCS tool.
find . -name .svn -exec rm -rf {} \;
find . -name .svn -exec echo {} \;
--head
– performs HEAD http request (not GET).
curl --head https://www.wp.pl/
--get
– performs GET request
-i
– include headers
curl --get -i https://www.wp.pl/
So, you have to copy one directory into another on your server and you don’t want to kill the machine?
Instead of
cp -r master master_copy
use
rsync --bwlimit=30000 -av master/ master_copy/
The –bwlimit=KBPS switch is for limiting I/O bandwidth.
Small thing but extremely useful. Getting context with grep
.
-C
– Print num lines of leading and trailing context surrounding each match. The default is 2 and is equivalent to -A 2 -B 2. Note: no whitespace may be given between the option and its argument.
grep -C 5 file.txt
If you have to remove large number of files, like hundreds of thousands, and don’t want to kill your production server, instead of rm -fr DIR
you can use this little fella.
while [ true ]; do ionice -c 3 find DIRECTORY_TO_BE_DELETED -type f -print | head -50000 | xargs rm -f; sleep 50; done