Help answer threads with 0 replies.
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 12-29-2004, 01:43 PM   #1
LQ Newbie
Registered: Dec 2004
Posts: 4

Rep: Reputation: 0
using bash in cron to get the date in filename

Can anyone help me with a mysqldump to a windows share that will allow me to save the name of the file as the current date using cron? It will dump to a file with a static name but I would rather it not write over a previous file. Thanks.
Old 12-29-2004, 03:39 PM   #2
Senior Member
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 110Reputation: 110

DUMPFILE="mysqldump_$(date '+%Y-%m-%d').sql"
mysqldump --opt --databases "YourDatabaseName" >"$DUMPFILE"
Read "man date" for more options on the format of the date. I used "<year>-<month>-<day>" here because that'll sort better.


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
bash returns ambiguous redirect with date in filename rstoutmna Programming 5 09-13-2011 08:37 PM
logrotate with date in filename ptp Linux - Newbie 1 04-14-2011 11:55 AM
Script add date to filename amphion Linux - Newbie 2 06-02-2004 08:12 AM
use date as output filename? wijnands Linux - Newbie 1 05-12-2004 04:39 PM
how to add date to filename x2000koh Programming 1 07-08-2003 10:44 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:27 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration