Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
I'm often surprised how many people in general aren't aware of what things should be done to ensure a healthy, well-running Mac. The UNIX subsystems on OS X were originally written for machines that were typically never shut off. OS X inherits this assumption, and has many system maintenance tasks that are scheduled to run between 3 AM and 5 AM. In addition, there are scripts designed to run weekly on weekends, and once a month in the middle of the night.

So, if these maintenance tasks are never run (such as on a Mac that is always shut off at night), many log files and system database will grow extremely large or fail to get backed up.

One thing Mac users need not worry about however is defragmenting their drives. Although I do it myself, it's definitely not a necessity.

Hard disk capacity is generally much greater now than a few years ago. With more free space available, the file system doesn't need to fill up every "nook and cranny." HFS Plus avoids reusing space from deleted files as much as possible, to avoid prematurely filling small areas of recently-freed space.

In general, fragmentation is often caused by continually appending data to existing files, especially with resource forks. But now, with faster hard drives and better caching, as well as the new application packaging format, many applications simply rewrite the entire file each time. Panther can also automatically defragment such slow-growing files. Aggressive read-ahead and write-behind caching means that minor fragmentation has less effect on perceived system performance.

For these reasons, there is little benefit to defragging. :cool:
 
~Shard~ said:
I'm often surprised how many people in general aren't aware of what things should be done to ensure a healthy, well-running Mac. The UNIX subsystems on OS X were originally written for machines that were typically never shut off. OS X inherits this assumption, and has many system maintenance tasks that are scheduled to run between 3 AM and 5 AM. In addition, there are scripts designed to run weekly on weekends, and once a month in the middle of the night.

No need to do this anymore with 10.4.1 and above. These scripts have been moved to launchd so that whenever you wake up our Mac, even in the middle of the day, these scripts will run.
 
CalGrunt said:
No need to do this anymore with 10.4.1 and above. These scripts have been moved to launchd so that whenever you wake up our Mac, even in the middle of the day, these scripts will run.

I was not aware of this, being on Pnather still - thanks. :cool:
 
~Shard~ said:
So, if these maintenance tasks are never run (such as on a Mac that is always shut off at night), many log files and system database will grow extremely large or fail to get backed up.
Launchd should take care of this and run them later. Much like anacron.

EDIT: WAY, WAY too slow. I guess I should stop opening 10 posts at once in tabs.:eek:
 
grapes911 said:
It should. Are you running Panther? Test it out for me :D
I am still figuring out how to copy (of course with due respect I am asking your permission) your script.

Some naive questions:

1. where is /etc/?
2. my crontab and
3. run it as root, how?

Thanks in advance! ;)
 
I like to run AppleJack about once a month. It repairs permissions, rotates logs, flushes caches, verifies preference files and runs fsck (disk repair). Just about everything you need to keep your Mac healthy. If nothing else, you should at least repair permissions from Disk Utility and reboot about once a month if not more often.
 
fayans said:
I am still figuring out how to copy (of course with due respect I am asking your permission) your script.

Some naive questions:

1. where is /etc/?
2. my crontab and
3. run it as root, how?

Thanks in advance! ;)

Of course you can use it. :D .

Here are step-by-step instructions on how to use it. I'll try to explain things too so can learn it, rather than just copy it. I'll make it as general and as basic so anyone can follow it. Sorry if comes out too basic for you, but I want to allow everyone to use it. Actual terminal command or code will be in italics.

1. Open terminal

2. Type cd /etc cd changes the working directory. /etc tell what directory to change too.

3. Type sudo pico maintenance sudo gives you more administrative permissions. You need this special permission because /etc is a system directory. Be careful what you do here. Any command preceeed by sudo will require your password. Pico is a text editor. The name following pico is the filename. If it exists, it will open that file. If it doesn't, it will create it. So we are opening a file called maintenance in the directory /etc because that is our current working directory.

4. You are now in the pico program. I already explained above what this does, so just type this:
#!/bin/bash

# start
say "now entering custom maintainance"

# repair permissions
diskutil repairPermissions /

# software update
softwareupdate -ir

# update prebindings
update_prebinding -root /

# end
say "custom maintainance has finished"


5. Press ctrl and o at the same time to save the file. If it won't save, you probably forgot to use the sudo when you opened the file.

6. Press ctrl and x to exit pico and go back to the command line.

7. Type sudo chmod 555 maintenance in the command line. I've explained what sudo does. It should not ask you for a password this time because you already typed it in before. chmod changes permissions of the file maintenance. The 555 is the permissions. Basically it makes the file maintenance executable.

8. Type sudo pico crontab in the command line. This opens your crontab in pico. You should see something like this:
# The periodic and atrun jobs have moved to launchd jobs
# See /System/Library/LaunchDaemons
#
# minute hour mday month wday who command


9. Now we fill it in.
9a. Under minute we put the minute we want it to run (00-59).
9b. Under hour we put the hour we want it to run (00-24).
9c. Under mday we put the day of the month we want it to run (1-31)
9d. Under month we put the month we want it to run (1-12)
9e. Under wday we put the day of the week we want it to run (0-7, 0 and 7 are both Sunday)
9*. Any of the above can be *, meaning every. Example, under mouth if you put *, it will run every month.
9.f Under who we put who we want to run the script. Generally we want scripts to run as root.
9g. Under command, we put the path to the script.
Here is what mine looks like:
# minute hour mday month wday who command
00 3 * * 3 root /etc/maintenance

This at 3:00 (00,3),
every day of the month (*),
every month (*),
on wednesday (3),
by root.
The script is /etc/maintenace.

10. Press ctrl and o at the same time to save the file.

11. Press ctrl and x to exit pico and go back to the command line.

Done. Sounds complicated, but it is not. I'll have to proofread it later, my class is about to start. Hope it helps.
 
wow I kinda got the impression that this post wasnt going anywhere so I havent looked at it in like a week and now its biig. (random fact) thx for all the imformation.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.