Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

stevietheb

macrumors 6502a
Original poster
Jan 15, 2004
591
0
Houston
I occasionally use MainMenu to do a bunch of maintenance tasks. Now there is a "batch task" option that allows you to perform any combination of the following tasks with just one click:

Repair Disk Permissions
Run All Cron Scripts
Update Prebindings
Clean User Cache
Force Empty Trash
Clean Archived Logs
Clear All Browser History
Empty All Browser Cache

Currently, I have it set up to do all of these except "Clear All Browser History."

So, I was thinking to myself, "How nice, I could just set this up to run every night when I go to bed..."

My question then, is this, is there such a thing as too much maintenance? Could there be any unforeseen problems with running this on a nightly or bi-nightly basis?

Thanks...
 

terriyaki

macrumors 6502a
Aug 4, 2005
640
9
Vancouver
risc said:
Why do people keep recommending apps to run the nightly, weekly, and monthly cron jobs by hand? This is pointless on a UNIX box, do what every other UNIX does and install Anacron for Tiger.

If you need it for Jaguar or Panther get it here.
Can Anacron do all the tasks MainMenu performs? I noticed it says that Anacron logs it's activities in a .log file... is that .log file ever cleaned/purged?

What exactly are the daily tasks? Weekly? Monthly?
 

iGary

Guest
May 26, 2004
19,580
7
Randy's House
I like Onyx, and run all the scripts about three times a week.

This machine gets wickedly heavy use, and it's finicky.

Don't need browser cache myself and web pages change so often anymore...
 

terriyaki

macrumors 6502a
Aug 4, 2005
640
9
Vancouver
Well I've googled about Anacron and haven't really figured out what exactly it does. I know it does maintenance tasks but I'd like to know what the tasks are specifically and how often they run.

The link for Anacron above doesn't really mention anything other than something along the lines of, "install Anacron and it will do all of this stuff for you and you won't even know it's there!"

I'm already using MainMenu and I like it... but Anacron sounds really cool. I just wanted some info about it before trying it since it sounds like I won't even be able to know and see what it does when it does it.
 

mrichmon

macrumors 6502a
Jun 17, 2003
873
3
terriyaki said:
Well I've googled about Anacron and haven't really figured out what exactly it does. I know it does maintenance tasks but I'd like to know what the tasks are specifically and how often they run.

OS X like most other Unix variants has a mechanism for automatically running tasks at specified times. This mechanism is called "cron".

The main maintenance tasks necessary on OS X are set up as cron jobs during an install of OS X. In addition to other things, these default cron jobs compress and archive the most recent 8 versions of the system log files as compressed files.

Since laptops (and many desktops) are generally not powered up 24/7 then the cron jobs scheduled to run when the machine is powered down or asleep will not be run. Many periodic cron jobs are scheduled to happen at 2am or 3am since the assumption is that the computer is less likely to be busy at that time.

Manually running the command "periodic monthly", "periodic weekly", and "periodic daily" is a way of manually triggering some of the scheduled cron jobs. What Anacron does is it monitors the scheduled cron jobs and ensures that any cron jobs that are not executed due to the computer being shutdown are run the next time the machine is powered up.

In comparison to MainMenu, Anacron would eliminate the need to perform the "Run All Cron Scripts" and "Clean Archived Logs" tasks in MainMenu. I would advise against "Clean Archived Logs" if that task is really deleting the archived logs since the archived logs can be extremely helpful in troubleshooting problems. And since the default cron jobs archive and rotate the logs it is unlikely that the system logs will consume more than say 1MB of your disk space.

In terms of the other things MainMenu does (at least according to the list above), it isn't necessary to clear your cache's regularly and in fact doing this will reduce performance in certain areas. Force emptying the trash can bite you from time to time.

Updating prebindings/repairing disk permissions are operations that should generally only be done as required. They are unlikely to hurt anything if you do them often but you are running something as root and the general rule is that you should avoid running anything with root access unless you really need to. In this case, by updating the prebindings regularly you are assuming that the prebinding specification is always correct on your system. If a bad apple update (as happened earlier this year), or maybe some malicious code changed the prebinding specification then by running prebinding regularly you are introducing problems as a side effect of rebuilding the bindings. A similar issue could arise with repairing disk permissions.

Just some information, I'm not associated with anacron in any way. But I have used it for ages on various Unix machines without any problems.

Edit: More details on what Anacron does can be found on the original OS X Anacron page: http://www.alastairs-place.net/anacron.html
 

terriyaki

macrumors 6502a
Aug 4, 2005
640
9
Vancouver
mrichmon said:
since the default cron jobs archive and rotate the logs it is unlikely that the system logs will consume more than say 1MB of your disk space
What do you mean by archive and rotate the logs? Does that mean the log files are "pruned" (so to speak) from time to time... like deleting events that have happened more than 30 days ago?

I agree with you, though.. in the event of an unknown problem or problems logs would be very useful.

Thanks for your help, mrichmon. :)
 

mrichmon

macrumors 6502a
Jun 17, 2003
873
3
terriyaki said:
What do you mean by archive and rotate the logs? Does that mean the log files are "pruned" (so to speak) from time to time... like deleting events that have happened more than 30 days ago?

I agree with you, though.. in the event of an unknown problem or problems logs would be very useful.

Thanks for your help, mrichmon. :)

Rotating and archiving the logs means that periodically the current log is compressed and moved with only a set number of previous logs being stored. This is easier to explain with an example.

Say you have the log file "system.log".

Code:
system.log

When the periodic log rotation is run, the current "system.log" file is renamed to "system.log.0" and compressed using gzip which results in a file named "system.log.0.gz".

Code:
system.log.0.gz

Then your system runs for a while producing more information in the system.log file so you end up with two files:

Code:
system.log
system.log.0.gz

The next time the rotation runs, "system.log.0.gz" is renamed to "system.log.1.gz", then the current system.log is renamed and compressed as described above. The result will be two compressed log files then after the system runs for a little and produces some log data you will have three files: (The system.log file is only recreated when there is log data to record.)

Code:
system.log
system.log.0.gz
system.log.1.gz

Eventually you will get to the point where you have 'n' logs... for the system.log file n=9, for other log files such as secure.log and install.log n=5. So, you have the following files:

Code:
system.log
system.log.0.gz
system.log.1.gz
system.log.2.gz
system.log.3.gz
system.log.4.gz
system.log.5.gz
system.log.6.gz
system.log.7.gz
system.log.8.gz

Where system.log is the current system log file and system.log.8.gz is oldest system.log file still on the system. system.log.8.gz is the log file that was archived 8 log rotations ago.

So at this point when the logs are rotated, system.log.8.gz is deleted. system.log.7.gz is renamed to system.log.8.gz, system.log.6.gz is renamed to system.log.7.gz and so on until system.log.0.gz is renamed to system.log.1.gz and then the system.log file is renamed to system.log.0 and compressed to system.log.0.gz.

The net result is that you always have the current log, and the last n backup logs. You can see these files on your system by opening a terminal and entering the command: (pay attention to the modification dates on the files to get an idea of what is going on with the files.)

Code:
ls -la /var/log

So, yes they are pruned, but it is not pruning based on so many days but rather on when the cron tasks are run. The system.log file is rotated daily by the default cron jobs in 10.4. secure.log is rotated every couple of days install.log looks like the rotation schedule is determined by the a period of time or the size of the current log file.

Hope this helps.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.