Results 1 to 6 of 6
Good Day.
I am need of a small script.
I have a dir " /var/lib/mysql " that I need to back up.
I want to write a small script to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-19-2008 #1Just Joined!
- Join Date
- May 2007
- Posts
- 33
Simple Linux Script Help
Good Day.
I am need of a small script.
I have a dir " /var/lib/mysql " that I need to back up.
I want to write a small script to take the whole directory and put it into an zip file and name the file mysql$datewithhoursandminute.zip. Then I will cron it to write it every night as well as whenever I make major changes I can run it manually.
Thanks a ton.
Curtis
- 02-20-2008 #2Just Joined!
- Join Date
- May 2007
- Posts
- 33
Bump? - Any links at least?
- 02-20-2008 #3
#!/bin/bash
file="mysql$(date +%d%m%y%H%M%S).zip"
zip $file /var/lib/mysqlLinux User #453176
- 02-20-2008 #4Just Joined!
- Join Date
- Feb 2008
- Location
- chennai
- Posts
- 24
hii kieren,
#!/bin/bash
file="mysql$(date +%d%m%y%H%M%S).zip"
zip $file /var/lib/mysql
could you explain why you gave is line beac i can't understand date +%d%m%y%H%M%S
- 02-20-2008 #5
I assume you are actually trying to backup mysql db and not just a folder called mysql. if thats the case this is the best mysql backup script I have ever used SourceForge.net: AutoMySQLBackup
you give it usernames and passwords along with what db's to backup. I have it doing nightly backups and rotating 7 days worth, then weekly backups and keeping up to 52 weeks, and then a yearly backup. It does it all itself and knows what day to do what, I just have the same cron job run every night and it does the rest.
- 02-21-2008 #6
If you type 'date' into your console you will get an output like:
Thu Feb 21 09:55:32 GMT 2008
Adding +%d%m%y%H%M%S after date formats the current date as <day of month><month><year><hour><minute><second>. So if you type date +%d%m%y%H%M%S the above date would be output as:
21022008095532Linux User #453176


Reply With Quote

