Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-16-2004, 07:33 AM   #1
Registered: Dec 2003
Location: Florida
Posts: 157

Rep: Reputation: 30
Shell Script for Gzipping with date output

Hi, I got a cron job already set up for doing a mysqldump (Via cPanel), now what i need to do is create a shell script to gzip the DB dump and output the file name to filename-xx-xx-xxxx.sql.gz

Does anyone know if there is a already configured script for this, or does anyone know what the script should be??


Sorry if this is the wrong forum for this.
Old 10-16-2004, 07:39 AM   #2
Senior Member
Registered: Dec 2001
Location: 35.7480 N, 95.3690 W
Distribution: Debian, Gentoo, Red Hat, Solaris
Posts: 2,070

Rep: Reputation: 47
This is one I wrote a while back. You'll just need to edit it a little.


echo "Enter directory name"
read arg1

DATE=`date +%Y%m%d`
mkdir "$DESTDIR"

cp -r $arg1/* $DESTDIR
tar czvf $DESTDIR.tar.gz $DESTDIR
rm -rf $DESTDIR


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script to remove old files based on date WindozBytes Linux - General 12 06-04-2012 02:21 AM
How do I make PHP display output from my shell script? farmerjoe Programming 2 04-03-2005 02:15 PM
shell script output redirection goral.j Programming 3 01-27-2005 06:34 AM
Shell Script (adding a prefix to output lines) rheza Programming 3 01-04-2005 02:18 PM
bash:output file names from shell script to vi sickboy Linux - Newbie 6 10-14-2004 04:40 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:57 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration