LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 11-20-2008, 05:21 AM   #1
andykulkarni1985
LQ Newbie
 
Registered: Sep 2008
Posts: 5

Rep: Reputation: 0
Post Quick Help


Hi All,

I am working in Linux AS 2.1,
1 )I will like to setup a cronjob which will run on every last day of the month.
2) I am working on DB servers which are on linux AS 4.1 daily wise we get almost 200-300 logs created by users. I would like to run a cronjob not daily wise though but it should be monthly wise.Like say for the month of Oct if there were 45000 logs created it should be zipped in one file oct.zip this should be for every month.I need to run a cronjob for this as well.

Experts time and response will be of grt help

regards
Andy
 
Old 11-20-2008, 05:54 AM   #2
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
For 1) I recommend setting the cron job to the first day of the month, rather than the last. That's just easier to configure. What does the job do exactly? Otherwise, I guess a script will be necessary (ie for the leap year detection), or at least multiple cron jobs (ie to run the job on 31st of Jan/Mar/..., 30th of Apr/..., 28 or 29 Feb).
2) You should try logrotate for easier log file handling.
 
Old 11-20-2008, 07:32 AM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

Welcome to LQ!

What have you done to date to solve 'YOUR' problem? We are here to assist not on demand request to do 'YOUR' work.
 
Old 11-20-2008, 12:47 PM   #4
andykulkarni1985
LQ Newbie
 
Registered: Sep 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Hi onebuck,

It was a request nt a demand though...thanks for providing me with the links of no help... well i could manage to solve myself the first query ..

for 2nd issue i wanted to Zip all the file in one go... for which i tried below steps which is of no help sir.

find ./-name /Path 'R*.lis'-mtime +30 -exec gzip {} \;

wht this is doing is it is zipping all the files which i dont need that ..i want all the files either for that day or month.. to be zipped in one folder.. that will reduce lot of my space.. :-)

request you to guide me through as i am a newbie..

Regards
Andy
 
Old 11-20-2008, 01:26 PM   #5
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

You came across as if you wanted someone to do the work for you.

If you want to learn something then proceed from where you are working, as suggested you should use the first of the month. Another good place to look would be 'Advanced Bash-Scripting Guide'.

This link and others are available from 'Slackware-Links'. More than just SlackwareŽ links!
 
Old 11-21-2008, 01:44 AM   #6
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
gzip & other zip tools only compress files, they don't create archives (containing multiple files, possibly compressed).
You should take a look at the tar command. The -z option will be of particular use to you, as you can have tar compress
the created archive (create a .tar.gz/.tgz in one go, rather than just a .tar that needs to be gzip'ed afterwards).

Code:
man tar
info tar
for details...
 
  


Reply

Tags
cronjob, last



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
quick hello traycerb LinuxQuestions.org Member Intro 2 02-11-2007 04:36 PM
A quick hello and why I'm here gmorris LinuxQuestions.org Member Intro 4 07-27-2006 05:50 PM
Quick help please a.adlyy Linux - General 1 06-01-2006 10:47 PM
Just a quick hello to everyone... jjake LinuxQuestions.org Member Intro 2 01-10-2006 03:12 PM
Really quick one finegan Linux - General 2 01-20-2002 06:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:58 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
Open Source Consulting | Domain Registration