LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Shortcut Question (https://www.linuxquestions.org/questions/linux-newbie-8/shortcut-question-133219/)

gauge73 01-09-2004 06:34 PM

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?

chrisk5527 01-09-2004 06:43 PM

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.

gauge73 01-09-2004 08:24 PM

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. :)


All times are GMT -5. The time now is 01:08 AM.