LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-09-2004, 07:34 PM   #1
gauge73
Member
 
Registered: Jan 2003
Location: Dallas, TX
Distribution: Fedora Core 4
Posts: 420

Rep: Reputation: 30
Shortcut Question


I have in my crontab file a backup script that runs every day. I want to redirect this output to a new log file each day with the following format...

backup-(date).log

Aren't there shortcuts that I can put in the command that will achieve this? Something like...

backup (directory) (files) > backup\d.log

Or something like that?
 
Old 01-09-2004, 07:43 PM   #2
chrisk5527
Member
 
Registered: Oct 2002
Location: Michigan
Distribution: Slackware Linux 10.0
Posts: 289

Rep: Reputation: 30
You could do something like:

----
$LOG="/var/log/backup.`date` # Or you could use `date +%m%d+%y` (Month, Day, Year)
/sbin/dump -0u -f /dev/tape /dev/hda? > $LOG
-----

Remember though, that the > operator will overwrite any existing data in that file. Use >> to append the data to the end of the file.
 
Old 01-09-2004, 09:24 PM   #3
gauge73
Member
 
Registered: Jan 2003
Location: Dallas, TX
Distribution: Fedora Core 4
Posts: 420

Original Poster
Rep: Reputation: 30
Could I use the command substitution in the redirection and eliminate the use of the variable? It doesn't matter, but I am curious.

Thanks a bunch for the response.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
KDE shortcut key question redss Linux - General 1 05-16-2004 10:08 PM
Possible Shortcut? AliasE Linux - Software 1 01-15-2004 08:06 PM
execute/shortcut kfrancisco Linux - Software 5 09-28-2003 03:30 PM
How to make shortcut? Nicksan Linux - Software 2 06-20-2003 04:38 PM
how to add shortcut to X? Quest Linux - Newbie 4 09-12-2002 07:11 AM


All times are GMT -5. The time now is 06:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration