[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-users] RaQ4 - datestamp filenames in script
- Subject: Re: [cobalt-users] RaQ4 - datestamp filenames in script
- From: Bruce Timberlake <bruce@xxxxxxxxxx>
- Date: Thu Jan 30 16:19:01 2003
- Organization: BRTNet.org
- List-id: Mailing list for users to share thoughts on Sun Cobalt products. <cobalt-users.list.cobalt.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> I've got a small script running via cron to backup my MySQL
> databases, it works but I'd like to amend this to create a new
> backup file each day with the date in the filename. What I'd like
> to see is the date appended to the filename, i.e.
> mysqldump30012003.tar.gz - the format of the date is not important
> to me so long as it's recognisable.
Just insert
`date +%Y%m%d`
wherever you want the date (YYYYMMDD is the order I showed; you can
change to suit) to appear. For example:
tar cvfz $DESTINATION_DIR/mysqldump`date +%Y%m%d`.tar.gz
"man date" for other options besides %Y %m and %d...
- --
Bruce Timberlake
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+OcD3vLA2hUZ9kgwRApcyAJ91JACkGBOLQCF7Wvq/cfSc/f11NgCZARhd
lpjNTblEkbP5qQLLuM5WqqI=
=F72e
-----END PGP SIGNATURE-----