[Done] Modification of MySQLDump-files before compression needed
Hi @all!
In my MySQL-backup-script I backup and compress every single table with this command:
Unfortunately these files need modification - they have to start with the following line(s):
which is not supported by mysqldump (when exporting single tables)
With the echo-command I can produce the files I want, but all the linebreaks are missing - causing the file to crash at import...
so I wrote a new script using "cat" - but there I could only get through by writing the data to the disk:
so ... is there anybody out there, who can do this without creating the two helper-files?
thx
g
Last edited by gogo555; 03-07-2013 at 11:21 AM..
Reason: Thread marked as [Done] - thx
Server version: 5.5.29-0ubuntu0.12.04.1 (Ubuntu)
mysqldump Ver 10.13 Distrib 5.5.29, for debian-linux-gnu (x86_64)
does NOT add the drop or create-command even using the --skip-opt option and unless exporting a whole database or a single table.
@CarloM:
sry my question was not precise enough:
There's no problem in the first 2 lines, but with the .sql-file generated by:
this command produces a text-output with linebreaks that vanish when the echo command combines USE_Anweisung and the text-output
What the script should do is:
1. create a dump-text-output with MySQLDump
2. add a (short) text-prefix in front of the output from #1
3. compress it to somwhere
... avoid writing temporary files to disk ... if possible.
You'll need more code. You may try something like this.
The code assumes that:
- your shell supports ANSI escape sequences, otherwise you'll need to enter a literal TAB in the first assignment
- your shell supports the ${variable/pattern/string} parameter expansion
- your client is configured to connect to MySQL directly (i.e. it doesn't prompt for username and password)
The script will back up all tables from all databases. If you want to backup only a specific database(s),
you could use:
what I try to figure out ist, if it is possible to shorten this block:
to one line -and it is! e.g. with:
but unfortunately the output of `$MYSQLDUMP $db $tb` looses it's linebreaks when the echo-command is working. That's the reason why I used cat, and 2 files, but in general I avoid writing this temporary data to the disk - maybe cat works with some kind of:
but I'm not familiar at all with this...
Hi ...programmers...
I need a shell script to perform some specific task..
my txt file looks like this
netcdf new {
dimensions:
XAX1_11 = 11 ;
variables:
double XAX1_11(XAX1_11) ;
XAX1_11:point_spacing = "even" ;
XAX1_11:axis = "X" ;
float DEPTH(XAX1_11) ;... (19 Replies)
I have a DB folder which sizes to 60GB approx. It has logs which size from 500MB - 1GB. I have an Installation which would update the DB. I need to backup this DB folder, just incase my Installation FAILS. But I do not need the logs in my backup. How do I exclude them during compression (tar)?
... (2 Replies)
I have a script that produces two output files each containing the same number of lines <file1.txt> and <file2.txt>. What I need to do is combine both files into a new file <file3.txt> where line 1 of <file1.txt> is put to the right (and on the same line) as line 1 of <file2.txt> and then the same... (5 Replies)
Hi everyone,
I have files like file1_Mod.txt, file2_Mod.txt. I want to rename the old files with the last modification date. I write the below script to rename with current date, but I donīt know how to use "date -r" to get the last modification date with the same format I have below... (5 Replies)
I want to take a backup of a database and redirect the output of the whole process to a log file. I am using the below command:
mysqldump -A --add-drop-table > mysql-daily-backup.sql &> /tmp/backup_log/mysql.log
Is there anything wrong with the syntax?
---------- Post updated at 08:32 PM... (0 Replies)
Hi,
I was very surprised to not be able to find an answer to this question despite my best efforts in Google and elsewhere. Maybe it's a good thing as it forced me to finally become a member in this great forum that i use frequently.
Ok my question:
I want to be able to sort files inside a... (3 Replies)
Hi all,
I am manipulating a ram disk image.that is 7za compressed...
But i somehow am not able to get a hold of the command line for 7za compression and i need urgent help!!!
this is what am doing...
gzcat /path/to/directory/x86.microroot >/tmp/microroot
x=`lofiadm -a /tmp/microroot`
mount... (0 Replies)
I have been doing some investigation into a log file from one of my systems, and the means which I currently use to compress and rotate it. I am looking for something smarter than gzip, faster than bzip2, and that can match or beat "my script" (which is slow as heck, but WAY better compression... (2 Replies)
How do I get the modification time for files less than 6 months old?
(It seems for fles as old or older than this I get to see only the day,month and year. I tried the option -u but it gives me the last accessed time) (1 Reply)