Re: Scripting Disk Utility in OS X
Re: Scripting Disk Utility in OS X
- Subject: Re: Scripting Disk Utility in OS X
- From: Rob Morton <email@hidden>
- Date: Wed, 23 Apr 2003 12:45:00 -0400
on 4/22/03 9:21 PM, Joel Belizario at email@hidden wrote:
>
Hi Rob,
>
>
> You wouldn't. You can't repair a disk at login unless you mean repairing a
>
> disk that you are not booted from. You can use diskutil for some things.
>
>
>
> do shell script "diskutil repairPermissions /" with administrator
>
privileges
>
>
Thanks for the info, I've got 4 firewire drives hooked up to my TiBook and I
>
wanted to have them checked and repaired upon login. I was surfing around
>
for more information and came upon this page at Bombich Software, am I on
>
the right track? (Yes, I am a complete newbie to scripting in ANY form.)
>
>
http://www.bombich.com/mactips/scripts.html
What you are looking out will get you started with login scripts. I believe
that login scripts need to be shell scripts. Since you are essentially going
to be issuing shell commands, this is probably the best means to do it.
You can also do this in AppleScript and then use the AppleScript application
as an item launched at login through the system preferences. Since this is
an AppleScript mailing list, that would look something like...
set AdminPassword to "<admin password>"
do shell script "diskutil repairDisk '/Volumes/<drive name1>' &" password
AdminPassword with administrator privileges
do shell script "diskutil repairDisk '/Volumes/<drive name2>' &" password
AdminPassword with administrator privileges
do shell script "diskutil repairDisk '/Volumes/<drive name3>' &" password
AdminPassword with administrator privileges
do shell script "diskutil repairDisk '/Volumes/<drive name4>' &" password
AdminPassword with administrator privileges
There are only 5 lines in the script. One for the password and 4 do shell
script lines, so be careful with the text wrapping.
The & at the end of each do shell script command should have dropped it into
the background. That didn't seem to work even when I tried...
ignoring application responses
do shell script "diskutil repairDisk '/Volumes/<drive name1>' &" password
AdminPassword with administrator privileges
do shell script "diskutil repairDisk '/Volumes/<drive name2>' &" password
AdminPassword with administrator privileges
do shell script "diskutil repairDisk '/Volumes/<drive name3>' &" password
AdminPassword with administrator privileges
do shell script "diskutil repairDisk '/Volumes/<drive name4>' &" password
AdminPassword with administrator privileges
end
which seems that it should have worked.
Anyway you look at it, fsck (or diskutil) does not always repair a volume in
the first go around. Generally, you are suppose to run it over and over
again until volume appears to be ok is returned. That becomes more
challenging and seems to be a huge amount of over kill.
Rob Morton
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.