Creating/running Terminal command with Automator

I am using Parallels Desktop on my iMac. Occasionally after I shutdown Parallels Desktop/Windows the ram it used is not released back, for example, depending on what I'm running in Parallels Desktop I can use upto around 16GB or ram. Ocassionally when I shutdown Windows and in doing that Parallels Desktop too, this ram level does not go back down. I find that going into Terminal and entering the purge command puts the ram level down to what it was before I loaded up Parallels Desktop.
I was wondering if its possible to use Automator to create a shortcut that I could then either place on my Desktop or Dock and when needed I could just double click on it and it would then load Terminal and then the purge command?
Or is there another way that I could automate the purge command?

I managed to work it out for myself.
I done the following:
In Automator I chose Application/Run Shell Script. In the box that appeared in the right side I entered purge. I then saved it to my desired location and I then dragged it onto the Dock for easy access.

Similar Messages

  • Terminal commands with automator

    So I am not really used to scripts and the script language nor in automator, I only made a few apps with automator like resize picture and show/hide hidden files.
    Now I am about to make an app which cleans my OS, I would like to run all these commands with one click, rather then copy pasting them into terminal one- by-one.
    sudo rm -rf /private/var/log/*
    sudo rm -rf /private/var/folders/
    cd /private/var/tmp/; rm -rf TM*
    cd ~/Library/Caches/; rm -rf ~/Library/Caches/*
    this would clean my mac caches and logs, like i would run it every week as im a power user.
    Please someone tell me how to put all these into automator and try to be detailed. Thanks for the support!

    Thanks for both positive, useful and sarcastic responses. The main reason is why I want to do this is becasuse I use different browsers, and all the cache they make is 2-3GB/day, as I use the web the most.
    I see the reason why NOT TO clear it and I do understand it, but after a week it is 10-15GB for me.
    And no, there isnt anyone else using my Mac, and the logs which I would nuke at every start and only keep the last and updated logs. I only need the startup and boot log.
    @barney-15E yes it would be fun though
    So then, I wont do anythings, as it cannot be done the way I wanted. I'll keep using Onyx.

  • Terminal commands with automator and Safari

    Hey guys, I'm trying to create an automator that will open safari, enable private browsing, go to my site, and log myself in. The problem is I need a terminal command line that will ensure private browsing is enabled. Any tips / help is appreciated. Thanks

    Terminal and Unix queries are best posted to the Unix forum under OS X Technologies.

  • Terminal Command with Automator

    ok i want to use the automator to run a script so that i can view my hidden files without going through the terminal
    defaults write com.apple.finder AppleShowAllFiles FALSE
    KILLALL Finder
    these are the command but i cant get automator to run them please help

    Hi,
    What do you mean when you say you can't get Automator to run them? I created a workflow with a Run Shell Script action, put the 2 lines in the body of the action, and it seemed to work just fine.

  • Understanding a Create Folder Terminal Command

    Good morning Apple users,
    An ex-colleague of ours created a Terminal command for our workplace that generates multiple blank folders for work documentation to be saved into per the "job number/folder number". i.e Job Number 17813 would go into the folder of the same number.
    For obvious reasons we would prefer to avoid having to manually generate such folders.
    He left the script with us but we are having trouble understanding it's use to generate new folders with the same structure. I'm hoping someone could break it down for me and help me understand how it works?
    I've attached the script as it's written for you to dissect.
    The above is the script within Text/Edit. When opening the file and attempting to do the requested "Please enter the thousands part of the SRO range: " in multiple combinations from "18000" to "18000 - 18999" and simply "18" it responds with the following message, Attached below:
    I'm sure our issue is something minor and we are just missing some tiny detail. Your assistance in getting this working is greatly appreciated!
    Thanks in advance.

    I haven't run your script, but the relevant part seems to be the error message:
    OSError: [Errno 2] No such file or directory: '/Volumes/OSX Raid/Service/Service Documentation/'
    To me, this says that the target parent directory doesn't exist, and is likely failing on the line:
    os.chdir(path)
    since you can't change to a non-existent directory. The rest of the script is irrelevant at this point.
    So you need to look at why this command might fail. The most obvious problem would be that it doesn't exist - maybe the volume isn't mounted, or the path doesn't match _exactly_. My python is rusty, but the spaces in the path may also be a problem (most shell commands barf at spaces in path names) - you might want to identify the path as a 'raw' string:
    path = r'/Volumes/OSX Raid/Service/Service Documentation/'
    (note the leading 'r')

  • Run os commands with sql

    dear all,
    is it possible to run os commands with sql commands as follows :
    SQL> ALTER system kill session '1764,60569'; ! kill -9 12151
    2 /
    ALTER system kill session '1764,60569'; ! kill -9 12151
    ERROR at line 1:
    ORA-00911: invalid character
    kai
    os version : solaris 5.10.. db : 10.2.0.4.0

    Kais,
    What exact error are you getting running this script and what's OS (is it linux RH?? If you can post errors on running this script, that will be helpful. I tested on both cygwin (my desktop) and liunx box but you can change as needed) and to kill process from script you can use
    echo `kill -9 pid`
    Hope this helps
    #!/bin/bash
    typeset username=$1
    function readSqlstmt {
    typeset stmt=$1
    echo "
    set feedback off
    set verify off
    set heading off
    set pagesize 0
    whenever sqlerror exit 1
    whenever oserror exit 2
    $stmt;
    exit
    " | sqlplus -S '/as sysdba >> test.log
    function killpid {
    killpidsql=killpid.sql
    sqlplus -s '/as sysdba' << ENDOFSQL >> test.log
    whenever sqlerror exit 1
    whenever oserror exit 2
    SET pagesize 0
    SET verify off
    SET feedback off
    SPOOL ${killpidsql}
    SELECT 'ALTER system kill session ''' || s.sid || ',' || s.serial# || ''';'
    FROM v\$session s, v\$process p
    WHERE s.paddr = p.addr AND s.status = 'INACTIVE';
    SPOOL OFF
    @${killpidsql}
    ENDOFSQL
    killpid
    readSqlstmt "SELECT p.spid FROM v\$session s, v\$process p WHERE s.paddr = p.addr AND s.status = 'INACTIVE'" | while read u
    do
         #echo "kill -9" $u >> test.log
         echo "Killing inactive oracle process..."
    echo `kill -9 $u`
    done

  • Trying to automate a Terminal command with a password

    Hi,
    I'm a long time Mac user, but not a Terminal expert.
    I've come upon a simple hack that enables me to run two instances of Skype simultaneously. This enables me to use it with two different user names.
    The idea is to create another user on the computer and run the other Skype like this:
    sudo -u user "/Applications/Skype.app/Contents/MacOS/Skype"
    In order to simplify this for daily use, I'd like to create a small applet which runs this terminal command.
    Trying to do so with Automator's +Run Shell Script+ fails with an execution error, probably due to the fact that this sudo command requires an admin password.
    Is there any way to accomplish this?
    Thanks

    hmm... I'm afraid that didn't do the trick. It now opens the Terminal window and launches Skype with the message "another copy of Skype is already running".
    Maybe I should add another step to workflow instead?
    Thanks again, I really appreciate your help.
    Guy

  • Quicker way of running terminal commands?

    Hi,
    I have a .sh file that I need to execute regularly. Up until now I have been opening up terminal and running code similar to this:
    cd /
    cd Applications
    cd SimpleDesktop
    bash sdesktop.sh
    Wherupon the file would execute and JRE would take over. I have tried just bash then dragging the file into the terminal but that doesn't work; I have to change directories manually first for some reason.
    What I would love to know if, through the wonders of OS X, there is a way of eliminating all that typing. If I could just click an icon and sdesktop.sh would launch it would be great.
    The .sh file is desperate to open in TextEdit by default.
    Help is much appreciated
    Message was edited by: Rory Mercer

    Everybody is going to scream.
    I opened Automator. I selected Automator from the list of apps. This narrows it down to where you can see "run shell script". Drag that into the window on the right. I then pasted in the single line of text I had copied from a website that was discussing unmounting volumes. I think I left the pass setting as "to stdin". If you select the option to show action when run it will prompt you each time you run it. Now save as an application. Double click to run the app. In my case the app takes several seconds to run despite it being only one line, but maybe that's because the drive has to be put away before I see anything.
    Okay, I have never done any thing at all with Automator before this, don't know anything about shell scripts, just know a few Unix shell commands. If you do anything with this that goes wrong I don't know you, have never heard of you, and I'll claim somebody hacked my computer and pretended to be me writing all this. On the other hand if it works I will bask in the glory of the multitude of blessings from you.
    Seriously, back up your drive before you do this. I really am a novice and I know just enough to be dangerous.

  • How to run Terminal commands in Xcode?

    Anyone knows how to include Terminal commands ( like sudo) in Xcode?  for example in a line of my program I need to run this:
    sudo open/Library/Preferences/com.apple.sharing.firewall.plist
    I searched the library but found no class or routine for that.

    Well, I am not a professional programmer, but one of the things I continue to learn is how to wade through all of the Cocoa documentation (and it does get deep in spots).  Chances are though, no matter what you are trying to do, Apple or some third party has created a class to make it easier - you just have to find it.  My Xcode documentation bookmarks continue to grow, but you might start with some of Apple's documentation, such as
    Cocoa Fundamentals Guide
    Foundation Framework Reference
    Application Kit Framework Reference

  • Running Terminal Commands at Login

    Hi everyone!
    Just a quick question for anyone who may know the answer. I am trying to automatically run two terminal commands at login:
    sudo pmset -a halfdim 0
    sudo pmset -a halfdim 1
    I have absolutely no idea what I am doing, so if someone knows and can help me out, that would be great! Thanks a lot!
    ~ Philip

    Trying to make the screen wink at you when you login?
    You could install Platypus and create a little shell script with it and put it in your Login items. The script would be something like
    <pre class=command>sleep 30; sudo pmset -a halfdim 0; sleep 0.2; sudo pmset -a halfdim 1</pre>
    Those sleeps should be tweaked for the best effect. If sudo prompts you for a password, then it won't work.
    Message was edited by: jarik
    Hey man, check out the day we registered here!

  • Create folder / file icon with automator

    Guys,
    I know very little about using Automator.
    I was wondering if there is a way to create folder / file icons using automator to take an image of the contents of the file (maybe an image file / autodesk or sketchup drawing etc). The process would be similar to the way image files such as jpeg etc display the image as the file icon automatically.
    Hope this makes sense.
    Cheers....Scotty

    Have you considered using rsync?  This has the benefit of only copying only changed files on subsequent backups.
    Here's rsync wrapped in Applescript:
    set SrcDir to (choose folder with prompt "Please select Source directory")
    set DestDir to (choose folder with prompt "Please select Destination directory")
    set SrcDir to text items 1 thru -2 of POSIX path of SrcDir
    do shell script "/usr/bin/rsync -aHE --delete --exclude=\"*.mpg\" " & space & SrcDir & space & POSIX path of DestDir
    For a list of rsync options, in Terminal, enter: man rsync.

  • How to run Unix command with Pipe ( | )?

    Dear Friends,
    I have to execute the below unix command through java program.
    *ps -ewwo pid,args | grep -E "abc.sh|xyz.jar" | gawk '{ print $1 }' | wc -l*
    My code to execute this command is,
    Runtime run = Runtime.getRuntime();
    File workDir = new File("/root/sat");
    String psCmd = "ps -ewwo pid,args | grep -E \"abc.sh|xyz.jar \" | gawk '{ print $1 }' | wc -l";
    Process process = run.exec(psCmd, null, workDir);
              String line;
              int i = process.waitFor() ;
              if(i == 0) {
              BufferedReader buf = new BufferedReader( new InputStreamReader( process.getInputStream() ) ) ;
              while ( ( line = buf.readLine() ) != null )
                   System.out.println("Line - ["+line+"]") ;
              } else {
                   BufferedReader stdErr = new BufferedReader(new InputStreamReader(process.getErrorStream()));
                   // read the output from the command
                   while ((line = stdErr.readLine()) != null) {
                   System.out.println(line);
                   }When i execute this command, i'm getting output as,
    ERROR: Garbage option.
    When i analyse the above error, i found that, the PIPE ( | ) command is not supported through java.
    Could anyone please help me how to execute the above unix command (with | ) in java?
    Thanks in advance,
    Sathish

    The pipe has to be interpreted by a shell so you need
    String[] psCmd =
        "sh",
        "-c"
        "ps -ewwo pid,args | grep -E \"abc.sh|xyz.jar \" | gawk '{ print $1 }' | wc -l"
    Process process = run.exec(psCmd, null, workDir);You should also read, re-read and then implement the recommendations in the 4 sections of http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html .

  • Running interactive command with Runtime.exec

    I'm trying to run a command via the Runtime.exec interface.
    Occasionally, the command needs to prompt for additional information. The response depends on the specific configuration, however, the command returns a list of options and then waits for a response.
    However, when the command waits for the response, my Java app hangs.
    After I call Runtime.exec, I create 2 threads to consume the contents of stderr and stdout. I then start them and call proc.waitFor()
    I would expect to see the output of the command in the stdout stream even though the command hasn't exited. I had hoped to parse the output to determine the necessary response. However, the calls to read the contents of the stdout and stderr streams block and I never see any output.
    How can I get access to the contents of those streams while the command is still running? Is this supported through the Runtime.exec interface?
    Thanks,
    Shawn

    This article should help:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Create run-as-account with less secure option in C#

    Hi all,
    Is there any way I can create run-as-account using C# code with less secure option.
    I have referred this code.
    ManagementGroup managementGroup = ManagementGroup.Connect(System.Environment.MachineName);
    Microsoft.EnterpriseManagement.Security.SimpleCredentialSecureData runAsAccount = new Microsoft.EnterpriseManagement.Security.SimpleCredentialSecureData();
    runAsAccount.Data = ConvertToSecureString("sample");
    runAsAccount.Description = "Sample run_as_account_description";
    runAsAccount.Name = "Run_as_account";
    runAsAccount.UserName = "sample@abc";
    managementGroup.Security.InsertSecureData(runAsAccount);
    But it creates account with more secure option.

    Hi,
    I searched the internet and found below link about SecureData type, not sure whether it can be useful for you as I am not familiar with
    SimpleCredentialSecureData() method, but you may refer to it and check it.
    SecureDataType Enumeration
    http://msdn.microsoft.com/en-us/library/hh964361.aspx
    In addition, I would liketo suggest you also post in the MSDN forum for coding issue.
    Regards,
    Yan Li
    Regards, Yan Li

  • Need to run netsh command with elevated previledges

    Hi Team,
    I am running an script with netsh command for to enable file & print sharing module and that to only for an domain profile.
    But when i try to call this command through VB script, it asks me to run that in elevated previledges.
    PLease help me how do i achieve that, or is there any feasibility to invoke same in bat file itself, please let me know.
    Regards,
    Deepak Sharma.

    Here are couple of URL that might help you : 
    http://stackoverflow.com/questions/17466681/how-to-run-vbs-as-administrator-from-vbs
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/310e57f9-2367-4293-9f97-53d0e077aacc/vb-script-to-run-a-batch-script-as-admin?forum=ITCG
    http://www.server-world.info/en/note?os=Other&p=vbs
    Arnav Sharma | http://arnavsharma.net/ Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading
    the thread.

Maybe you are looking for

  • ALV Display   in this Format

    Hi All , I have a problem  in ALV  grid /List... I can  print the data in two  header line and item lines. But needed output in three header /line  items as shown : Basic LTA MED Educ Other VDA 15000 1000 500 6000 600   500000         6000      8000 

  • Encrypt on CLR decrypt in SQL?

    Hi folks, I'm trying to encrypt a small token of data on my client c# application and have it decrypted by SQL on the server side, the problem is i cannot find articles on the subject. I don;t really want to get involved with certificates but base th

  • Replace g60 modem with voice fax data mpdem

    I have a HP G60-23US lap top. For a special application I need to replace the basic "data/fax" modem with a "voice/data" modem.  Where can I find detailed specifications for size of the basic CX 11256 modem so I can look for a replacement.

  • Sampling lot not reflecting in inspection Lot

    Hi We set up the QM master data (QI info- record  /  QI PLAN / QI Inspection / QI sampling schema / inspection chars  / Dynamic modification rule etc.. The inspection lot was creating automatically . I coudn't find any samples in the inspection lot (

  • Authenticated user name not written to access log file

    Our users are authenticated with certificates to an LDAP directory server. The Access log file is using the Extended-2 format. The name of the authenticated user is now written in the Access log. 10.4.57.44 - - [19/May/2004:14:07:21 -0400] "GET /some