Solved

Adding date to filename in a shell script

Posted on 2004-04-25
2
3,215 Views
Last Modified: 2013-12-16
hi I have tar -cf /home/1.tar *.* in a script to do a Daly backup with I need is to change 1.tar to the date i.e. 1-2-04.tar etc i am guessing the clock or date commands would need to be used thanks
0
Comment
Question by:kingpin200004
2 Comments
 
LVL 57

Expert Comment

by:Pete Long
ID: 10911444
Theres a Perl Script here that includes the funtionality you are after?
http://www.imagefolio.com/resources/mods/backup/index.txt
Pete
0
 
LVL 1

Accepted Solution

by:
joesp earned 125 total points
ID: 10912602
Here's my little mysql backup script.  
#!/bin/sh
present=`date +%b%d%y`
mysqldump -uUSERNAME -pPASSWORD --databases THIS_ONE_DB > $present.sql

which produces files like
~
Feb1604.sql

god bless
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question