Shell Script or Applescript to run disk permissions repair
Tried doing this Applescript in Automator:
do shell script "sudo diskutil repairPermissions /" ¬
password "yourAdminPassword" with administrator privileges
This works, but the process appears to run without shutting down when it's done.
Can anybody suggest an addition or modification to terminate when the permissions repair is completed?
do shell script ¬
"sudo diskutil repairPermissions / ; exit" password "yourpassword" with administrator privileges
Similar Messages
-
How to do multiple shell scripts in AppleScript
I got some solutions from previous posts on how to run sudo in Applescript, but there is still some minor syntax issues when I try to get to the destination directory. Usually in shell script I just type
cd directory-destination
in several lines to batch process those commands, but when I work with applescript, if I do do shell script for every "cd" command, instead of getting an overall result, I would get intermediate results individually.
I read doc and learned that there might be a way to put commands together by using the & sign?
Message was edited by: ttbackAn individual do shell script command runs in its own shell, so to perform multiple commands within that shell you need to combine them into a single statement. You can use the ampersand '&' operator to concatenate text strings, and the semicolon ';' to separate the commands, for example:set theFolder to "/Applications"
do shell script "cd " & theFolder & "; ls -l ."See the technical note do shell script in AppleScript. -
How to retrive ip address of connected device in shell script or applescript
Hi all,
From Mac PC, how to get ip address of connected device in shell script or applescript.
there is any way to launch an app on ipad in shell script or applescript.
thank you in advance for your help
MickaelHi all,
From Mac PC, how to get ip address of connected device in shell script or applescript.
there is any way to launch an app on ipad in shell script or applescript.
thank you in advance for your help
Mickael -
My iMac, OS 10.7.5, is abnormally slow on start-up, taking many minutes for my password sign-in window to show up. I've run Disk Permissions and have verified my hard drive and all is in order. What do I do to start up my Mac in a normal manner?
If you have more than one user account, these instructions must be carried out as an administrator.
Launch the Console application in any of the following ways:
☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
Step 1
Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
View ▹ Show Log List
from the menu bar.
Enter "BOOT_TIME" (without the quotes) in the search box. Note the timestamps of those log messages, which refer to the times when the system was booted. Now clear the search box and scroll back in the log to the last boot time when you had the problem. Select the messages logged after the boot, during the time something abnormal was happening. Copy them to the Clipboard (command-C). Paste into a reply to this message (command-V).
For example, if the problem is a slow startup taking three minutes, post the messages timestamped within three minutes after the boot time, not before. Please include the BOOT_TIME message at the beginning of the log extract.
If there are runs of repeated messages, post only one example of each. Don’t post many repetitions of the same message.
When posting a log extract, be selective. In most cases, a few dozen lines are more than enough.
Please do not indiscriminately dump thousands of lines from the log into this discussion.
Important: Some private information, such as your name, may appear in the log. Anonymize before posting.
Step 2
Still in Console, look under System Diagnostic Reports for crash or panic logs, and post the entire contents of the most recent one, if any. In the interest of privacy, I suggest you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if present (it may not be.) Please don’t post shutdownStall, spin, or hang logs — they're very long and not helpful. -
Not permission to install Lion into my iMac HD even after running Disk Tools repairing permissions ???
Post the exact text of the error message you get.
-
Warning after running disk permissions
After running disk permissions on my internal hard drive I get the following message:
Warning: SUID file "System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/MacOS/ARDAg ent" has been modified and will not be repaired.
Does any one know what this means?This is one of the most common bugs being reported about Leopard, and has to do with the installation of the Remote Desktop Client software update through Software Update. There is no official fix for this, and repairing permissions in general seems to be quite problematic with Leopard.
If your system seems otherwise stable and free from major problems, it may be worth waiting for Apple to take care of this via another software update or some other remedy. -
Time machine full backup after disk and disk permissions repair
my macbook would not boot so i inserted the snow leopard DVD and did a disk repair and disk permissions repair, after that it booted perfectly but when it went to do a backup it did a full backup of 149GB , i am unsure why it has done this and would like to know how to stop it as i am trying to save space on my time capsule.
thank you in advanceBrycycle wrote:
i do not wish to let it do a full backup so as to save space on my time capsule but this is the log up till when it started transferring data.
I'm afraid you don't have much choice. You do have lot of space available, though.
Node requires deep traversal:/ reason:must scan subdirs|new event db|
No pre-backup thinning needed: 165.92 GB requested (including padding), 507.60 GB available
The "deep traversal" means TM compared everything on your system to the backups, and estimates that about 138 GB is new/changed (it adds 20% for workspace on the TM disk - the "padding" in the message).
If there's about 138 GB on your system, see #D3 in [Time Machine - Troubleshooting|http://web.me.com/pondini/Time_Machine/Troubleshooting.html] (or use the link in *User Tips* at the top of this forum), for some common reasons for TM to do a new full backup.
If there's more, #D4 there has some common reasons for large backups.
If all you did was repair disk and permissions, neither should have resulted.
the reason i did a permission repair and disk repair while running from the install disk was because my laptop would not boot from the internal disk so i did both just to be safe.
That's fine; just do the Permissions Repair again, while running normally. -
How do I run a shell script via AppleScript?
Seems obvious, "do shell script" but that doesn't work for me.
I have an Automator app which runs a shell script, I'd like to take that into an AppleScript. My AS doesn't run the shell script. Perhaps "do shell script' is expecting the script to be located elsewhere? The rest of my AS runs fine, but the shell script doesn't.
repeat with i from 1 to count of items in exportFolder
do shell script
"exiftool -overwrite_original -Photoshop:CopyrightFlag='True'"
done
end repeat
As I say this works within an Automator app, what changes do I need to make it work in AppleScript?
Thanks!Camelot wrote:
repeat with i from 1 to count of items in exportFolder
What is 'exportFolder'? Where is it defined?
Thanks, 'exportFolder' is defined earlier in the script. The purpose of the script - which is run from within Aperture - is to rename the selected images, export them (to the 'exportFolder'), reset the version name and, using ExifTool, add metadata which Aperture does not write to exported JPEGs.
I have a version of this which works in Automator but I couldn't see any clues there on setting the path to ExifTool.
Here's the full (modified) script. Currently it returns an error
Result:
error "No file specified" number 1
so I now need to understand if I can use 'exportFolder' (defined at the start) to tell Finder which folder to use.
-- Creating filenames by making Version Name from the IPTC Headline and Filename (with hypens where spaces exist). The Aperture Version Name is used to create the file's name on export. Once exported the Aperture Version Name is reset to its original.
tell application "System Events"
set exportFolder to (choose folder with prompt "Choose an export folder")
end tell
tell application "Aperture"
set theSel to (get selection)
if theSel is {} then
error "Please select an image or two!."
else
repeat with theImg in theSel
-- Creating a new Aperture Version Name which will become the exported file's filename.
tell theImg
set headline to (get value of IPTC tag "Headline" of theImg)
set AppleScript's text item delimiters to " "
set theTextItems to text items of headline
set AppleScript's text item delimiters to "-"
set headline to theTextItems as string
set AppleScript's text item delimiters to {""}
set objectName to (get value of IPTC tag "ObjectName" of theImg)
set newVersion to (headline & "-" & objectName) as string
set name of theImg to newVersion
end tell
end repeat
-- Exporting the files as JPEGs to chosen folder/Project Name using the Version Name as a filename
export theSel using export setting "JPEG - Original Size" to exportFolder
-- Resetting the Aperture Version Name back to filename using IPTC Title (which should be the file's filename without suffex).
repeat with theImg in theSel
tell theImg
set title to (get value of IPTC tag "ObjectName" of theImg)
set name of theImg to title
end tell
end repeat
end if
end tell
--Using ExifTool to set Photoshop Copyright Status etc
tell application "Finder" to set theFiles to files of exportFolder as alias list
repeat with eachFile in theFiles
do shell script "/usr/bin/exiftool -overwrite_original -Photoshop:CopyrightFlag='True' -Photoshop:URL='http://davidgordon.co.uk/'" & quoted form of POSIX path of eachFile
end repeat
display dialog "Done that!" with icon note buttons "OK" default button 1 giving up after 10 -
I have a program that I run via Terminal, but I don't want a terminal window open while I run it (Just personal preference). I have an applescript set up to run the Terminal command, but the thing is that the command is "on" while the program is running, Is there some way that I can have the command go and then end the script wihtout closing the program? Or am I out of luck and have to have the Terminal window open?
The program I am using is located here http://sites.google.com/site/sc2gears/
Thanks for the help!The program is distributed (according to the docs) as a .command file, so you can get the efect you want like so:
do shell script "/Users/yourname/further/path/Sc2gears-os-x.command &> /dev/null &"
the &> /dev/null tells applescript that you don't care about any output, so it moves on to the next command, and the closing & sets the process up as a standalone. Note:
If the process doesn't close itself automatically you'll need a separate way of doing that
if the process produces output you want to keep, don't use /dev/null - use an appropriate file path
(obviously) '/Users/yourname/further/path' needs to be replaced with the correct path to the command, and needs to be single-quoted/escaped if it contains spaces or other unix-confounding characters -
Awkward shell script in Applescript
Hi,
I'm trying to get the following line of code to run in an Applescript:
ifconfig | grep "inet " | grep 192.168 | cut -d\ -f2
It works perfectly in terminal, but I can't for the life of me to work in an Applescript (I am aware of the double spacing requirements).
Any advice would be most welcomed.Is this what you want?
do shell script "ifconfig | awk '/inet/ { if (match($2, /192\.168\./)) print $2; }'" -
Find & replace part of a string in Numbers using do shell script in AppleScript
Hello,
I would like to set a search-pattern with a wildcard in Applescript to find - for example - the pattern 'Table 1::$*$4' for use in a 'Search & Replace script'
The dollar signs '$' seem to be a bit of problem (refers to fixed values in Numbers & to variables in Shell ...)
Could anyone hand me a solution to this problem?
The end-goal - for now - would be to change the reference to a row-number in a lot of cells (number '4' in the pattern above should finally be replaced by 5, 6, 7, ...)
Thx.Hi,
Here's how to do that:
try
tell application "Numbers" to tell front document to tell active sheet
tell (first table whose selection range's class is range)
set sr to selection range
set f to text returned of (display dialog "Find this in selected cells in Numbers " default answer "" with title "Find-Replace Step 1" buttons {"Cancel", "Next"})
if f = "" then return
set r to text returned of (display dialog "Replace '" & f & "' with " default answer f with title "Find-Replace Step 2")
set {f, r} to my escapeForSED(f, r) -- escape some chars, create back reference for sed
set tc to count cells of sr
tell sr to repeat with i from 1 to tc
tell (cell i) to try
set oVal to formula
if oVal is not missing value then set value to (my find_replace(oVal, f, r))
end try
end repeat
end tell
end tell
on error number n
if n = -128 then return
display dialog "Did you select cells?" buttons {"cancel"} with title "Oops!"
end try
on find_replace(t, f, r)
do shell script "/usr/bin/sed 's~" & f & "~" & r & "~g' <<< " & (quoted form of t)
end find_replace
on escapeForSED(f, r)
set tid to text item delimiters
set text item delimiters to "*" -- the wildcard
set tc1 to count (text items of f)
set tc2 to count (text items of r)
set text item delimiters to tid
if (tc1 - tc2) < 0 then
display alert "The number of wildcard in the replacement string must be equal or less than the number of wildcard in the search string."
error -128
end if
-- escape search string, and create back reference for each wildcard (the wildcard is a dot in sed) --> \\(.\\)
set f to do shell script "/usr/bin/sed -e 's/[]~$.^|[]/\\\\&/g;s/\\*/\\\\(.\\\\)/g' <<<" & quoted form of f
-- escape the replacement string, Perl replace wildcard by two backslash and an incremented integer, to get the back reference --> \\1 \\2
return {f, (do shell script "/usr/bin/sed -e 's/[]~$.^|[]/\\\\&/g' | /usr/bin/perl -pe '$n=1;s/\\*/\"\\\\\" . $n++/ge'<<<" & (quoted form of r))}
end escapeForSED
For what you want to do, you must have the wildcard in the same position in both string. --> find "Table 1::$*$3", replace "Table 1::$*$4"
Important, you can use no wildcard in both (the search string and the replacement string) or you can use any wildcard in the search string with no wildcard in the replacement string).
But, the number of wildcard in the replacement string must be equal or less than the number of wildcard in the search string. -
I can't get a simple "do shell script" in AppleScript to work!
Hi All,
I can get simple commands like "do shell script "ls"" or "do shell script "ps"" to work in AppleScript, but I cannot get something like "do shell script "python -V"" to work. (yes, my shell script says: do shell script "python -V" (no double quotes!))
This is driving me nuts!
Can anyone help?
- Jonpython -V appears to direct its output to stderr. Try
do shell script "python -V 2>&1" -
OS X System Freezes While Running Disk Utility repair permissions
While trying to pepair permissions systom freeze up. So I put in the startup disk hit restrat holding down c and tried to repair permissions that way and it froze up that way too. I had to manually turn off machine. What is going on?
Thanks for your response, I only have one disk. 10.5.1 I have 10.6 on usb drive. I will try running Disk Utility from the first DVD and instead of repair permissions try to repair your drives. The reason I was repairing permissions is I have an app called video converter and when I opened it I got an error window. Ok I will try repair disk. If that doesnt work I guess I will have to reinstall the os? Is that right? Ok, here I go to try it.
-
Shell Script gives error when run through cron job.
Hi,
The following shell script runs without any problem when executed manulally.
USED=$(df -h /arch | tail -1 | awk '{print $5}' | cut -d '%' -f 1)
if [ ${USED} -gt 90 ]
then
find /arch/AUBUAT/ -type f -mtime +0 | xargs rm
find /arch/AUBMIG/ -type f -mtime +0 | xargs rm
fi
But the same gives below error when called from a cron job:
/backup/arch_test.sh: syntax error at line 1: `USED=$' unexpected
We are running following version:
bash-3.00$ uname -a
SunOS uaeaubdbdr01.aub.af 5.10 Generic_141444-09 sun4u sparc SUNW,SPARC-Enterprise
Kindly assist.
Thanks
Edited by: user13362786 on Apr 20, 2011 4:36 AMHi,
When I used #!/usr/bin/sh now even the manul execution of the script fails with the same err:
bash-3.00$ ./arch_test.sh
./arch_test.sh: syntax error at line 2: `USED=$' unexpected
And when I used #!/usr/bin/ksh the manual execution runs fine but again when the script is run from cronjob it now give dirrect err:
/backup/arch_test.sh[2]: df: not found
/backup/arch_test.sh[2]: tail: not found
/backup/arch_test.sh[2]: cut: not found
/backup/arch_test.sh[2]: awk: not found
/backup/arch_test.sh[3]: test: argument expected -
Syntax for inserting a number in a shell script in applescript
who can help me correct this code?
the user will enter a number in a dialog box, and this variable will replace the 7 in the shell script.
i cant seem to keep the syntax right, i keep erroring out.
if days_back is "" then
set dialog_1 to display dialog "please enter a number " default answer ""
set the days_back to the text returned of dialog_1
end if
set the_result to (do shell script "mdfind -onlyin '/Volumes/Volume1' 'kMDItemFSContentChangeDate >=$time.today(-7)'")
display dialog the_resultTry using:
if days_back is "" then
set dialog_1 to display dialog "please enter a number " default answer ""
set the days_back to the text returned of dialog_1
end if
do shell script ("mdfind -onlyin '/Volumes/Volume1' 'kMDItemFSContentChangeDate >=$time.today(-" & days_back & ")'")
display dialog the result
(54186)
Maybe you are looking for
-
Old Apple ID appearing during IPhone app updates
When I attempt to update apps on my IPhone I am asked to give a password for an old Apple ID. How can I change the Apple ID linked to my I Phone when I attempt to upgrade applications? The "active ID" linked to my account is not presented. Have lo
-
I have a Mac mini (Mid 2011). It has become slow in some ways even though I have 8 GB 1333 MHz DDR3 memory and almost 250GB of free storage. I recently installed Yosemite 10.10.1 (14B25) but I had noticed the slow down prior to that. Notably, videos
-
Problem on HP Pavilion dv7-6c90el with Windows 8 Pro x64 on Video Card
good evening, I just finished installing Windows 8 x64 from Win7 Pro, I was able to find all drivers for my notebook, but I have problems with the video card settings. My laptop is a HP Pavilion dv7-6c90el with two video cards, one run by the process
-
Upgraded iphone 4 to ios5. Apps show but wont open when i click on them??
I upgraded my i phone 4 to ios5. All of my apps are still showing but when i click on them they wont open. Any ideas?
-
Do you know how to specify custom query strings for finder methods of CMP beans? null