[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cobalt-users] Re: Timestamp on filename?
- Subject: [cobalt-users] Re: Timestamp on filename?
- From: Bruce Timberlake <bruce@xxxxxxxxxx>
- Date: Thu May 29 01:26:01 2003
- Organization: BRTNet.org
- 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«
mysqldump -uxxxxxx -pxxxxx --opt db > \
/home/dbbackups/sqldump_`date +%Y%m%d-%H%M`.sql
would give a filename of
sqldump_20030529-0122.sql
for May 29 2003 at 01:22 am.
'man date' for more info and options.
FYI -- be wary of including the -p switch on the commandline (I know
there's no way around it for what you're doing but...) -- it will show the
password to anyone who's running "top" or a "ps -ef" command etc. If
nobody else has shell on the box, you're ok. Just make sure the user
password for the db is NOT the same as a user password on your system. :)
--
Bruce Timberlake