Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Can I schedule a periodical file permissions repair? With Automator, maybe?

share|improve this question
1  
Why do permissions in OS X get broken so frequently? I've always wanted to know. –  boehj May 30 '11 at 0:15
2  
@boehj Sounds like a good question for a little site I know of ;). –  Nathan Greenstein May 30 '11 at 0:19
    
@Nathan: Hah! Very good point. I'll have some breakfast and post it up. :) –  boehj May 30 '11 at 0:23
1  
Looks like we already have one. The answers didn't get much love though. –  boehj May 30 '11 at 1:02

2 Answers 2

up vote 6 down vote accepted

Go to the terminal and execute "crontab -e" to add a new crontab entry. Now there are numberous syntaxical ways you can accomplish what you want (read about it on wikipedia). The easiest one, however, will be to put

@monthly diskutil repairPermissions /

in it.

Note: You'll be using vi for editing. Press "i" to type, then after you've finished press ESC and type in ":wq" to save and quit.

share|improve this answer
    
Done it, thanx! I have no way to confirm diskutil is running, but a @hourly touch ~/crontest is, so I'll asume it works. –  Petruza May 30 '11 at 16:34
    
But now that I see, the @hourly touch ~/crontest works only when the OS is running at the exact **:00 hour, so will @monthly skip if the OS is not running at an exact time? like 1st day of month at 00:00 ? –  Petruza May 30 '11 at 16:37
    
Well the only way to fix that is to get a software called "anacron". It's apparently available from fink. The standalone version was compiled for Tiger, so I have no idea if that works on anything newer. Also I've never set it up on OS X, but there's probably a ton of Linux guides for it which should be transferable. –  XQYZ Jun 6 '11 at 3:09

You can do this with a combination of iCal, AppleScript, and Shell Scripting.

First, open AppleScript Editor (/Applications/Utilities). Paste this in:

tell application "Terminal"
    do script "diskutil repairPermissions /"
end tell

Go to File-> Save As. Select a safe but out-of-the way location. Set the File Format menu to Application.

Then, open iCal. Add a new event (call it something like "Auto-Repair Permissions"). Right-click the even and select Get Info.
Set the Repeat menu to something like Every Month (depending on how often you want to repair the permissions).
Under Attachments, click Add File... Navigate to the file you saved from AppleScript Editor.

Now, iCal will automatically (at the interval you selected under Repeat) open the app you created. That app opens Terminal and runs a command which verifies and repairs your permissions. The Terminal window has a progress meter and a list of the changes its made (along with any errors).

share|improve this answer
    
You could also run the script from cron or launchd or a GUI solution such as Script Timer –  daviesgeek May 7 '12 at 18:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.