LinuxQuestions.org
Review your favorite Linux distribution.
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 07-25-2005, 10:21 AM   #1
EganBursk
LQ Newbie
 
Registered: Jul 2005
Distribution: Ubuntu 5.04 Hoary
Posts: 5

Rep: Reputation: 0
Saving files with date names


I have ClamAV on my system and it runs a scan everyday at 5am then saves the log file to scan.txt.

what I like to do is save the file with the date it was ran so I don't keep over writing the scan.txt file. How can I do this?

Something like log=(getDate).txt?

Here is my cron tab:

00 05 * * * sudo clamscan -r -l /home/egan/Documents/Virus/scans.txt /
 
Old 07-25-2005, 10:45 AM   #2
Nathanael
Member
 
Registered: May 2004
Location: Karlsruhe, Germany
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940

Rep: Reputation: 33
Welcome to LQ!

00 05 * * * sudo clamscan -r -l home/egan/Documents/Virus/scans-`date +$y-%b-%d`.txt /

will give you the filename: scans-2005-Jul-25.txt
if you want to use different date formates, have a look at
#man date

NOTE: the quotes surrounding the data statement, are backquotes! they are not double quotes ( " ) they are not single quotes ( ' ), but backquotes ( ` )
this is important, otherewise it will not work correctly.
 
Old 07-25-2005, 12:12 PM   #3
EganBursk
LQ Newbie
 
Registered: Jul 2005
Distribution: Ubuntu 5.04 Hoary
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks Nathanael.

I've updated my cronjob and also ran a test just scanning my /home directory and works like a charm. I will research the man pages if I need a different date scheme.
Many thanks.

EB
 
Old 07-25-2005, 01:55 PM   #4
EganBursk
LQ Newbie
 
Registered: Jul 2005
Distribution: Ubuntu 5.04 Hoary
Posts: 5

Original Poster
Rep: Reputation: 0
Also a note:

Putting the hyphen after scan produces 2 hyphens on my box ie. scans--2005-Jul-25.txt. So I took the hyphen out after scan and it produced the desirerd result...scans-2005-Jul-25.txt.

Thanks
EB
 
Old 07-25-2005, 02:35 PM   #5
Nathanael
Member
 
Registered: May 2004
Location: Karlsruhe, Germany
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940

Rep: Reputation: 33
ops sorry, my bad, it needs to be a %Y instead of $y
 
Old 07-26-2005, 04:54 PM   #6
EganBursk
LQ Newbie
 
Registered: Jul 2005
Distribution: Ubuntu 5.04 Hoary
Posts: 5

Original Poster
Rep: Reputation: 0
No prob.

I read the man pages as you suggested and found the %Y.

Thanks for all the help.
 
Old 07-26-2005, 05:20 PM   #7
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 49
Something else to bear in mind is that you have no need whatsoever to run a virus scan on a linux box, unless it is a mail server or file server for window$ clients. Yes there are viruses for linux, but unless you are foolish enough to run as full time root, or trigger the virus as root, you have nothing to fear. The linux "viruses" really aren't worth being concerned with.

Peace,
JimBass
 
Old 07-27-2005, 06:14 AM   #8
EganBursk
LQ Newbie
 
Registered: Jul 2005
Distribution: Ubuntu 5.04 Hoary
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks for the info. Well I'm definately not running in those capacities. ClamAV does find a couple of files when it runs that are oversized but that's it. I'm paranoid so I don't mind running an antivirus.
 
  


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
Saving files rj686 Linux - Software 4 10-07-2004 10:09 PM
saving files in vi tekmorph Linux - Newbie 4 09-01-2004 10:36 PM
SAMBA: display of share names is OK but files names are wrong superandrzej Linux - Software 5 02-02-2004 09:14 AM
Saving files Ren Red Hat 2 01-09-2004 05:58 AM
Setting date day names Dark Carnival Linux - General 3 12-07-2003 01:22 PM


All times are GMT -5. The time now is 02:53 PM.

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