Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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..
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!
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).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.