LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Quick Help (http://www.linuxquestions.org/questions/linux-newbie-8/quick-help-684837/)

andykulkarni1985 11-20-2008 06:21 AM

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

timmeke 11-20-2008 06:54 AM

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.

onebuck 11-20-2008 08:32 AM

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.

andykulkarni1985 11-20-2008 01:47 PM

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

onebuck 11-20-2008 02:26 PM

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!

timmeke 11-21-2008 02:44 AM

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


All times are GMT -5. The time now is 09:23 PM.