[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-users] Timestamp on filename?
- Subject: Re: [cobalt-users] Timestamp on filename?
- From: "Andy Clyde, oxfordmusic.net" <cobalt-users@xxxxxxxxxxxxxxx>
- Date: Thu May 29 01:12:01 2003
- List-id: Mailing list for users to share thoughts on Sun Cobalt products. <cobalt-users.list.cobalt.com>
> Is it possible to add a timestamp to the file name?
> I have a cron job making a sqldump like this:
> mysqldump -uxxxxxx -pxxxxx --opt db > /home/dbbackups/sqldump.sql
>
> I would like to have the file named like this »sqldump_TIMESTAMP.sql«
>
i use this
#!/bin/sh
date=`date +%H%M`
mysqldump -uxxxxxx -pxxxxx --opt db > /home/dbbackups/sqldump_$date.sql
use man date to see the options for the date command. this script has date
in the format HHMM where HH is the current hour and MM is the current
minute.
andy