Wuu Posted March 14, 2016 Report Posted March 14, 2016 #!/bin/bash NOW=$(date +"%m-%d-%Y") echo $NOW #creat db backup mongodump -u ****** -p ****** -o /home/mongod/mongobackup/mongodBackup-$NOW --gzip tar -cvzf mongodBackup-$NOW.tar.gz /home/mongod/mongobackup/mongodBackup-$NOW HOST='******' USER='******' PASSWD='******' FILE='mongodBackup-'$NOW'.tar.gz' ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD cd /mongodbbackup put $FILE quit END_SCRIPT exit 0 Mēģinu saspiest mongodumpu un ielādēt uz serveri, bet atverot rāda ka arhīvs ir saplēsts. Kas varētu būt pa vainu? Ubuntu Quote
Wuu Posted March 15, 2016 Author Report Posted March 15, 2016 ftp pie vainas, ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD binary cd /mongodbbackup put $FILE quit END_SCRIPT exit 0 Pieliku binary, un viss aizgāja. Paldies :) Quote
Mr.Key Posted March 15, 2016 Report Posted March 15, 2016 (edited) Es pareizi saprotu, ka tu vispirms viņu ar mongo dump tūli saspied ar parametru --gzip, un pēc tam tar tūlim pieliec -z parametru otreizējai zipošanai? Edited March 15, 2016 by Mr.Key Quote
Wuu Posted March 15, 2016 Author Report Posted March 15, 2016 Jā, ideja tāda bija, jo mongodump uztaisi kaudzi ar failiem un mapītēm, gribās vienu. Beigu variantā noņemu --gzip, jo saspiežu pa taisno mapītes un failus. Nav jēga divreiz saspiest. Quote
daGrevis Posted March 15, 2016 Report Posted March 15, 2016 Ja gribi dabūt vienu lielu failu, izmanto tar (bez gz). Quote
Kasspars Posted March 15, 2016 Report Posted March 15, 2016 kopē ar scp uz otra servera uzliec ssh atslēgu un nevajadzēs skriptā rakstīt paroles Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.