Προς το περιεχόμενο

Automatic Permission Repair


Προτεινόμενες αναρτήσεις

Δημοσ.

I was recently reading a thread on the Mac User site about OS X Lion, one of the users from this forum suggested that automatic permission repair would be nice.

 

I had a think to myself, surely there must be a way to add this myself. After some poking around I found that OS X comes with a command line version of Disk Utility.app, with this one can repair permissions via the command line.

The CRON daemon is included with almost all UNIX based OS's, it is a utility that will execute a command at a given time, or a set of given times.

 

Mixing CRON and the command line utility diskutil, one can automate the repairing of permissions, simply open up Terminal.app (found in Applications/Utilities) and copy and paste the following:

 

TMP_CRONTAB=/tmp/tmpcrontab.$

crontab -l > $TMP_CRONTAB

echo "0 * * * * diskutil repairPermissions / >> /dev/null 2>&1" >> $TMP_CRONTAB

crontab $TMP_CRONTAB

rm $TMP_CRONTAB

 

This will repair permissions on the hour, every hour, every day, every month, every year.

For those who feel more daring, you can edit that third line. You can see the "0" for on what minute the script should run, the next field (the first *) is the hour, the third field is day of the month, the fourth is the month of the year, the fifth is a specific day of the week (Mon-Sun), and the sixth is the year. For example you may only want to run this on the hour and at half past, between 20:00 and 08:00, and between Monday and Friday:

 

TMP_CRONTAB=/tmp/tmpcrontab.$

crontab -l > $TMP_CRONTAB

echo "0,30 0-8,20-23 * 1-5 * diskutil repairPermissions / >> /dev/null 2>&1" >> $TMP_CRONTAB

crontab $TMP_CRONTAB

rm $TMP_CRONTAB

 

If it doesn't worry you and you just want it once every hour, simply copy and paste the first version.

 

Sometime I'll do a how-to on CRON, but if you want to know more there are plenty of articles on the Internet about it.

 

chuleta_cron.png

 

 

via http://www.x404.co.u...ion-repair-os-x

Δημιουργήστε ένα λογαριασμό ή συνδεθείτε για να σχολιάσετε

Πρέπει να είστε μέλος για να αφήσετε σχόλιο

Δημιουργία λογαριασμού

Εγγραφείτε με νέο λογαριασμό στην κοινότητα μας. Είναι πανεύκολο!

Δημιουργία νέου λογαριασμού

Σύνδεση

Έχετε ήδη λογαριασμό; Συνδεθείτε εδώ.

Συνδεθείτε τώρα
  • Δημιουργία νέου...