LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 10-16-2004, 06:33 AM   #1
Junior41180
Member
 
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??


Thanks.

Sorry if this is the wrong forum for this.
 
Old 10-16-2004, 06:39 AM   #2
darthtux
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.

#!/bin/sh

echo "Enter directory name"
read arg1

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

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


Reply



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 01:21 AM
How do I make PHP display output from my shell script? farmerjoe Programming 2 04-03-2005 01:15 PM
shell script output redirection goral.j Programming 3 01-27-2005 05:34 AM
Shell Script (adding a prefix to output lines) rheza Programming 3 01-04-2005 01:18 PM
bash:output file names from shell script to vi sickboy Linux - Newbie 6 10-14-2004 03:40 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:13 AM.

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