Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
add timestamp to file in linux
Name: nnyantengwar Date: April 28, 2004 at 16:03:44 Pacific OS: RHEL 3 CPU/Ram: P4 Xeon 4gb
Comment:
Hello, I am currently running a shell script on crontab that uses mysqldump to backup my db on a daily basis then FTPs the file to another server.
I have the script working fine but I would like to keep a "history" of the db by attaching the systems current date to the filename (EX sqlbackup_04282004.tar.gz sqlbackup_04292004 etc...)
Heres what I have working so far:
#! /bin/bash /usr/local/mysql/bin/mysqldump --opt -u username -pPASSWORD dbname > /home/dir1/dir2/dir3/backup.sql cd /home/dir1/dir2/dir3 tar -czvf sqlbackup.tar.gz /home/dir1/dir2/dir3/backup.sql lftp <<EOF open ftpserver user username password pwd ls put sqlbackup.tar.gz bye EOF
Name: Jake Date: April 28, 2004 at 17:21:04 Pacific
Reply:
Use "sqlbackup_`date +%m%d%Y`.tar.gz" for the filename. Note that those are backticks, not apostrophes. Read the man page for date if you want a different format.
Summary: To execute a file in linux you just type ./filename when in the same dir as the file, or /path/to/filename Thie does not work for .exe's though, they are windows executables, not linux executables, b...
Summary: This is FAST-HOW-TO to configure XDMCP on RedHat 7 / Linux 2.4.x from a Maiden Installation to have in Linux the same funtionality that comes with Solaris by default, the Graphical Enviroment GNOME (a...
Summary: Hi, I normally use IRIX or Linux. Sometimes I get msword attachment which i want to decipher.I have heard about abiword which an read msword files in linux but wasnot able to install it as I am not...