image
image

Go Back   macosx.com > Mac Help Forums > HOWTO & FAQs

Reply
 
LinkBack Thread Tools
  #1  
Old September 3rd, 2004, 01:50 AM
michaelsanford's Avatar
Translator, Web Developer
 
Join Date: Oct 2002
Location: Ottawa/Montréal
Posts: 2,278
Thanks: 0
Thanked 4 Times in 4 Posts
michaelsanford is on a distinguished road
[HOWTO] - Keep permissions up to date automatically.

The underlying BSD subsystem of Mac OS X, Darwin, uses a unix-style permissions system to determine who can see, access, search and execute files, folders and devices.

Installer packages (.pkg and .mpgk) install software and puts files in various locations throughout your filesystem. The Installer also keeps receipts of these installations to facilitate keeping permissions up to date.

Many, many, many seeminlgy random problems in OS X can be caused by permissions problems; repairing permissions is usually the first step recommended in troubleshooting a problem in OS X.

Instead of waiting for a problem to crop up, why not set up your Mac to automatically repair permissions every night ? Here's how (you'll need administrator access) :

1. Open Terminal.app and type sudo pico -w /etc/crontab and enter your password.

2. You should see a file that has contents similar to this:
Code:
# /etc/crontab
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
#
#minute hour    mday    month   wday    who     command
#
#*/5    *       *       *       *       root    /usr/libexec/atrun
#
# Run daily/weekly/monthly jobs.
15      3       *       *       *       root    periodic daily
30      4       *       *       6       root    periodic weekly
30      5       1       *       *       root    periodic monthly
10      *       *       *       *       root    /sw/sbin/anacron -s
Go to the bottom of the file and add the following line (note: the spaces are tabs!)
Code:
# /etc/crontab
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
#
#minute hour    mday    month   wday    who     command
#
#*/5    *       *       *       *       root    /usr/libexec/atrun
#
# Run daily/weekly/monthly jobs.
15      3       *       *       *       root    periodic daily
30      4       *       *       6       root    periodic weekly
30      5       1       *       *       root    periodic monthly
10      *       *       *       *       root    /sw/sbin/anacron -s

# Repair Permissions, added by me.
0       1       *       *       *       root    /usr/sbin/diskutil repairPermissions /
This will, every day at 01h00, repair permissions on the startup volume. Change the frequency to whatever you want, to a different time, once a week, whatever.

Alternatively you can use an application like CronniX, instead of the Terminal, to add the line to the system crontab.
__________________
michaelsanford.comIdenti.ca
• iMac Aluminum 24" |
MacOS X 10.5 (current) | 3.06 GHz Intel Core Duo | 4 GB RAM, 1 TB HDD
• Acer AspireOne 1.60 GHz | Windows XP Home | 1 GB RAM, 100 GB HDD
• AMD Athlon64 3500+ | Ubuntu
-server x86_64 | 1240 GB RAID
Reply With Quote
  #2  
Old September 20th, 2004, 01:49 AM
Registered User
 
Join Date: Jun 2004
Location: California
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Freiheit is on a distinguished road
Changing time for pre-defined scripts

Thank you for the quick UNIX crontab primer. My next question would be, does changing the time values for the pre-defined daily/weekly/montly tasks here make them run at better times? I know there are lots of utilities to force run those tasks "now" but I wonder why no one has made such a utility to simply change when they are run automatically. I would think if it was as simple as editing the crontab file, it would have been integrated into Cocktail, etc. by now.

Don
__________________
Don "Freiheit" Eitner
Computer literate Mac newbie
Reply With Quote
  #3  
Old September 20th, 2004, 06:56 AM
WeeZer51402's Avatar
Registered User
 
Join Date: Dec 2002
Location: Lost in my own unintelligible ramblings
Posts: 475
Thanks: 0
Thanked 0 Times in 0 Posts
WeeZer51402 is on a distinguished road
hmm you may be able to enhance performace by also putting in a line to use the command 'update_prebinding'
__________________
ON THE WAY:
15" PB 1.67|100|1024 --- 10.4
------------------------------------------
17" iMac G5 1.8|80|512|BT --- 10.3.9
FrankenMac G4 500|55|640 --- 10.3.9
PowerMac 9600 300|4|512 --- 1.2
eMachine 500is 500|4.3|196 --- OpenStep 4.2
Server 2.3|260|512 --- FedoraCore
Reply With Quote
  #4  
Old September 20th, 2004, 03:00 PM
scruffy's Avatar
Notorious Olive Counter
 
Join Date: Dec 2000
Location: Soviet Canuckistan
Posts: 1,726
Thanks: 0
Thanked 0 Times in 0 Posts
scruffy is on a distinguished road
You might actually want to let anacron handle that - I notice you have anacron in your crontab. The point of anacron is that it can make sure scripts that run with a frequency of days or weeks (not multiple times a day) will be run, even if the computer is not on 24/7 - unlike cron, where if the computer isn't on at 1AM, the job is missed.

Might even want to put periodic daily/weekly/monthly under anacron...

see http://anacron.sourceforge.net/
__________________

What is the robbing of a bank compared to the founding of a bank?
-- Bertold Brecht
Reply With Quote
  #5  
Old September 20th, 2004, 09:04 PM
WeeZer51402's Avatar
Registered User
 
Join Date: Dec 2002
Location: Lost in my own unintelligible ramblings
Posts: 475
Thanks: 0
Thanked 0 Times in 0 Posts
WeeZer51402 is on a distinguished road
Hmm interesting...I love free software
__________________
ON THE WAY:
15" PB 1.67|100|1024 --- 10.4
------------------------------------------
17" iMac G5 1.8|80|512|BT --- 10.3.9
FrankenMac G4 500|55|640 --- 10.3.9
PowerMac 9600 300|4|512 --- 1.2
eMachine 500is 500|4.3|196 --- OpenStep 4.2
Server 2.3|260|512 --- FedoraCore
Reply With Quote
  #6  
Old September 21st, 2004, 06:00 AM
fryke's Avatar
Super Moderator
 
Join Date: Sep 2000
Location: macosx.com
Posts: 14,074
Thanks: 13
Thanked 90 Times in 85 Posts
fryke is a jewel in the roughfryke is a jewel in the roughfryke is a jewel in the roughfryke is a jewel in the rough
One problem with this is that _if_ permissions are hosed, fixing them might not be enough to fix the problems one can have when they're 'unfixed': A reboot is often necessary... So: The cron (or anacron) job does its job, but you don't know whether there actually _were_ problems with permissions. I rather fix permissions once a week by hand - and if I see something weird come up in the process, I also reboot.

Ceterum censeo that Apple should try and fix the problem of always having to fix permissions... *sigh*
__________________
iMac 24" 2.4 GHz, 4 GB RAM, 320 GB HD. Mac OS X 10.6.1
MacBook Air 13" 1.6 GHz, 2 GB RAM, 80 GB HD. Mac OS X 10.6.1
Mac mini 1.83 GHz, 2 GB RAM, 80 GB HD. Mac OS X 10.6.1
MacBook nano (Lenovo S10e white) 1.6 GHz, 2 GB RAM, 250 GB HD. Mac OS X 10.5.7
iPhone 3GS 32 GB white.

Mac user since 1987, Apple Sales Professional 2009, Apple Product Professional 2007-2009, Apple Certified Support Professional 10.5, Apple Certified Pro Aperture 2 (Level 1)
Reply With Quote
  #7  
Old September 21st, 2004, 12:01 PM
michaelsanford's Avatar
Translator, Web Developer
 
Join Date: Oct 2002
Location: Ottawa/Montréal
Posts: 2,278
Thanks: 0
Thanked 4 Times in 4 Posts
michaelsanford is on a distinguished road
Fryke, WeeZer51402 and Apple should have a meeting

WeeZer51402, you don't have to update prebinding in OS X 10.3 because fix_prebinding is called every time you launch an application and updates it if necessary.

Fryke is right, Apple should fix this, maybe even in the style of fix_prebinding !

Adding it to the anaccrontab is a better idea, if you have a system that's not always on (like mine is).
__________________
michaelsanford.comIdenti.ca
• iMac Aluminum 24" |
MacOS X 10.5 (current) | 3.06 GHz Intel Core Duo | 4 GB RAM, 1 TB HDD
• Acer AspireOne 1.60 GHz | Windows XP Home | 1 GB RAM, 100 GB HDD
• AMD Athlon64 3500+ | Ubuntu
-server x86_64 | 1240 GB RAID
Reply With Quote
  #8  
Old September 21st, 2004, 06:13 PM
WeeZer51402's Avatar
Registered User
 
Join Date: Dec 2002
Location: Lost in my own unintelligible ramblings
Posts: 475
Thanks: 0
Thanked 0 Times in 0 Posts
WeeZer51402 is on a distinguished road
So I've heard about the prebindings, has this changed since 10.2 or has it always been this way?
__________________
ON THE WAY:
15" PB 1.67|100|1024 --- 10.4
------------------------------------------
17" iMac G5 1.8|80|512|BT --- 10.3.9
FrankenMac G4 500|55|640 --- 10.3.9
PowerMac 9600 300|4|512 --- 1.2
eMachine 500is 500|4.3|196 --- OpenStep 4.2
Server 2.3|260|512 --- FedoraCore
Reply With Quote
Reply

Bookmarks

Thread Tools

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump


All times are GMT -5. The time now is 04:32 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC1
Copyright 2000-2010 DigitalCrowd, Inc.