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!
--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.
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
If you would like to dump all tables and triggers and stuff try this one:
mysqldump -uUSER -p -R --opt --triggers DB > DB_DUMP.sql
but if you have some troubles with permissions for locking tables use --lock-tables=false
mysqldump -uUSER -p -R --opt --triggers --lock-tables=false DB > DB_DUMP.sql
and to dump all databases you have
mysqldump -uUSER -p -R --opt --triggers --lock-tables=false --all-databases > DB_DUMP.sql
also, great post on StackExchange with a script for dumping all databases without databases like `mysql`, `information_schema`, `performance_schema`, `sys`.
MYSQL_USER=root
MYSQL_PASS=rootpassword
MYSQL_CONN="-u${MYSQL_USER} -p${MYSQL_PASS}"
#
# Collect all database names except for
# mysql, information_schema, and performance_schema
#
SQL="SELECT schema_name FROM information_schema.schemata WHERE schema_name NOT IN"
SQL="${SQL} ('mysql','information_schema','performance_schema')"
DBLISTFILE=/tmp/DatabasesToDump.txt
mysql ${MYSQL_CONN} -ANe"${SQL}" > ${DBLISTFILE}
DBLIST=""
for DB in `cat ${DBLISTFILE}` ; do DBLIST="${DBLIST} ${DB}" ; done
MYSQLDUMP_OPTIONS="--routines --triggers --single-transaction"
mysqldump ${MYSQL_CONN} ${MYSQLDUMP_OPTIONS} --databases ${DBLIST} > all-dbs.sql