Automator workflow "run shell script" keeps running. How to stop?

Because i want two instances of dropbox running simultaneously on my Mac, I set up a small automator workflow application. The workflow consist of a simple shell script:
Or in text:
bash
HOME=$HOME/Dropbox-quivertree /Applications/Dropbox.app/Contents/MacOS/Dropbox &
The problem is that once the application runs, or i execute the script from within automator, it just keeps running (i get the little cog in my menubar). Anybody have an idea how to automatically stop after it has launched dropbox?
Thanks!
Kim

I do not have dropbox on my computer, so I tested using the Calculator application. The solution proposed by Mattis S.F. does work, but his explanation does not hold true in my case. Initially, I successfully tried
HOME=$HOME/Dropbox-quivertree nohup /Applications/Calculator.app/Contents/MacOS/Calculator >/dev/null 2>&1 &
If I remove the “nohup”, the result does not change. Removal of the “/dev/null 2>&1”, however, results in the same problem originally described by Kim van der Leeuw. My guess is the background process has stdout and stderr redirected by default back to the automator. When redirected to /dev/null, the automator no longer waits for the background process to complete. To summarize, change
HOME=$HOME/Dropbox-quivertree /Applications/Dropbox.app/Contents/MacOS/Dropbox &
to
HOME=$HOME/Dropbox-quivertree /Applications/Dropbox.app/Contents/MacOS/Dropbox >/dev/null 2>&1 &

Similar Messages

  • The Shell script keeps hanging

    Hello,
    I have the following shell script and when i execute, it keeps hanging and nothing happens
    Please let me know.
    Requirement is to read data from file and pass it to the sql and create files as shown.
    code
    #!/bin/sh
    while read user.dat
    do
    echo "user = $1 email = $2"
    done
    sqlplus -S /NOLOG << EOF
    connect username/pwd@schema
    select user_name,count(*) from apps.fnd_user
    where 1=1 and user_name ('$1') and email_address ('$2')
    group by user_name;
    EOF
    if [ $? -ne 0 ]
    then
    % cat > user_exist
    else
    % cat > user_notexist
    fi
    exit 0
    Data File
    rsreenivasa null

    Well, youy have many problems here:
    while read user.dat
    do
    echo "user = $1 email = $2"
    done
    The "user.dat" string is an invalid variable name, so this loop never runs.
    Then, in this sequence:
    if  $? -ne 0
    then
    *% cat > user_exist*
    else
    *% cat > user_notexist*
    fi
    The cat(1) commands then copy stdin to either "user_exist" or "user_notexist".
    You don't show how you run this command, so we cannot tell what happens exactly.
    Please delete everything below the "while read ..." loop. Get that loop working as you expect it should. Then add a few more lines and test those. Build the shell script incrementally, debugging each as you go.
    Hint: since this is a shell script, run it like this:
    $ sh -x ./myscript arg1 arg2 ...
    to see what happens as it happens.
    Cheers

  • MyApp is already running, how to stop a second launch?

    Suppose MyApp is already running, and the user double clicks the icon on the desktop to launch a new one. How do I stop the second app from launching? Is there a way to query the system to see what processes are running and have main() exit if it finds an instance of MyApp?

    How to allocate a free port number for such operation? I can see here a possible problem, if that port number is being used by an another application. Then it won't work and my app should use an another port number.
    If you only could use JNI (.dll or .so) to check for running application instance, that would give a less problems. Maybe a native code should enumerate all windows and read titles.

  • How to switch user from the current user using shell script code

    Hi Experts,
    I have an requirement to login into a particular user from the shell script concurrent program. I do have credentials for that particular user. I want to login and run few commands from that particular user. Please let me know if there are any methods to login as a particular user using the username, password from shell script program.
    Thanks a lot.

    Thanks for your reply. However we cannot use su command from a shell script program. How to enter password from shell script program?http://tinyurl.com/3t7cwjh
    Thanks,
    Hussein

  • Can any one tell me how can i call a shell script from pl/sql

    i like to call shell script from pl/sql procedure.
    can any one suggest how can i do this

    Have you not mastered in asking the same kind of question ?
    First do write a script...
    no one will spoon feed you.
    How can i call a shell script from procedure
    How to call Shell Script from pl/sql block
    -Sk

  • Help regarding  a shell script

    Hi,
    I had a requirement to execute a long running sql query. But the sql query had some parameters to be passed in it. I want to use nohup command and run the sql script using shell script concept. How can i pass the parameters and run the nohup command. I am herewith attaching sql reference.
    [http://hatchappsdba.blogspot.com/2008/01/how-to-run-rcv11isasql-type-of-files.html]
    I want to keep the sql script in a shell script and run it through nohup command.
    Can you please let me know how can i keep the above sql in a shell script and run through nohup command

    I want to keep the sql script in a shell script and run it through nohup command.
    Can you please let me know how can i keep the above sql in a shell script and run through nohup commandFrom the OS command prompt, issue:
    # nohup sqlplus <username>/<password> @<script name>.sql &Or as sysdba (if sysdba is needed to run the script):
    # nohup sqlplus "/ as sysdba" @<script name>.sql &Or, you can write a shell script as mentioned in this thread -- nohop sqlplus doubt
    Thanks,
    Hussein

  • AppleScript error -609 in Automator workflow

    I created an AppleScript on one computer and incorporated it in an Automator workflow. The script works perfectly well stand-alone or as part of the workflow.
    Then I copied both files to a headless computer via VNC. I adjusted the workflow to look at the new location of the script, and the script itself to look at the new location of the file it's processing. Now, on that second computer, the script works perfectly well by itself, but I get AppleScript error -609 Connection Is Invalid if it's run from the workflow.
    For testing purposes I reduced the script to its simplest expression:
    tell application "Finder"
    end tell
    and it's still generating the error.
    Strangely, from the workflow the full script does what's it's supposed to, but the workflow stops because of the error. The error appears even if this script is alone in the workflow. Does anybody know what it means?

    That error means that the script wasn't able to communicate with the targeted application properly, which can happen if the application crashes while the script is running. If that error doesn't cause any problems, it's appearance can be suppressed:
    try
    (your code)
    on error number -609
    end try
    This construct will not execute any code on or after the line which produces the error.
    (32099)

  • Executing shell script using OSLinetoken fetchlet

    Hii,
    I do have a requirement. I need to use a shell script in the OSLineToken fetchlet. In response metric i will be checking whether the directory exists or not on the server. In order to check the existence of the directory, i have created a shell script. But how can i relate its result with the Response metric? The shell script is as follows:
    Shell Script:
    if test -d $1 ; then
    echo "DIR exist"
    else
    echo "false"
    fi
    The Response metric for the same will be:
    <QueryDescriptor FETCHLET_ID="OSLineToken">
         <Property NAME="command" SCOPE="GLOBAL">
              sh {dir_name where the shell script is uploaded}/{shell script file name} {dir_name_parameter} </Property>
         <Property NAME="startsWith" SCOPE="GLOBAL">em_result=</Property>
         <Property NAME="delimiter" SCOPE="GLOBAL">|</Property>
    </QueryDescriptor>
    Please suggest what is the use of em_result here?
    once the existence of the directory is checked, if it up then i need to call another shell script in order concatenate the contents of all the files with extension .log(this will be the parameter of shell script). Get the output from shell script and display it into custom management plug-in. As i am using cat *.log>>consolidatefile command to concatenate the data, i need to read consolidatefile file from the server and return this concatenated file data into plug-in. Again, how can i read the content of consolidatefile file in EMF? I will be creating another matric for this purpose say "read_content". the querydesciptor of the same will be as follows:
    <QueryDescriptor FETCHLET_ID="OSLineToken">
         <Property NAME="command" SCOPE="GLOBAL">
              sh {dir_name where the shell script is uploaded}/{shell script file name} {dir_name_parameter} {extension of the files to concatenated} </Property>
         <Property NAME="startsWith" SCOPE="GLOBAL">em_result=</Property>
         <Property NAME="delimiter" SCOPE="GLOBAL">|</Property>
    </QueryDescriptor>
    I am not sure which all properties to be used in this case..I have seen multiple sample files some of them uses perbin, scriptsdir but some of them does not..The related pdf also does not say anyhting about such kind of properties. Please suggest.
    I hope the explaination of the problem is not so cumbersome. Please let me know if you have any query to understand.
    Thanks,
    AS

    If you notice, localScriptsDir is a directory within scriptsDir. If you package your plug-in up and deploy it through the UI, any scripts you create will go into %scriptsDir%/emx/<target_type>. So localScriptsDir just specifies that directory for you. You don't need it but then in the command paramater you'll have something like:
    sh %scriptsDir%/emx/yourtargettype/yourscript...
    So whether you specify it in the command or another property (localScriptsDir) doesn't really matter.
    You can create your own properties in the QueryDescriptor. Just make sure you have the correct scope specified and it should be fine (options for scope are described in the Enterprise Manager DTD section of the Extensibility Guide).
    Metric collection isn't really meant for dynamic specification of input parameters. I can think of a few solutions:
    1) Create a target instance for each log directory. When you create the instance, the directory is specified. If you need to monitor a different directory, you can just create another instance. Upside is that it's flexible and scalable, and also, when you get an error you'll know exactly which directory it is based on which instance throws the error. Downside is that you have to have a separate instance for each directory.
    2) If the log directories are well known and finite (and won't change names), hardcode them into the target metadata. Have a different metric collect for each log directory, so you'll have as many metrics as log directories you want to monitor. Even if the names of the directories are different, you can use instance properties to map them, so if you know there will always be 5 log directories you want to monitor, you can have 5 instance properties to map the names into the metrics, although this won't work if you don't have the same number each time. Upside is that there is only a single target instance. Downside is that it's not as flexible.
    3) Use a job rather than a target type to find out this information. You could create a new job type which scans the logs for information and have the directory as an input parameter to the job. You could have this job on a repeating schedule to duplicate the effect you are trying to get out of creating a target type. The upside is that you can start the job whenever you want from the UI and specify exactly which directory whenever you run it. The downside is that the job system is centered on the OMS rather than the agent, so every time it runs it will have to contact the agent to do the work. In the case of the target type, the agent acts autonomously without contact from the OMS.
    There are probably other options, but these are the quick ones off the top of my head.
    Chris

  • I need a 2 way sync tool for the mac (or a shell script and some help)

    I am looking for a way to (two way) sync a folder on my Macbook Pro with a SMB Server (aka Windows)
    I found a few paid for applications that do this, and before I buy one I thought I'd ask here and see if there are any recommendations.
    So far I've found Synk Standard and ChronoSync.
    I assume this could also be hacked together with Automator and some shell scripts, but I'm not sure how I'd do that.

    yes, Chronosync is often recommended for this kind of thing. Never heard of Synk Standard. you can also do it for free with rsync but I suggest you stick with Chronosync.

  • Execute worflow from shell script

    hello all, i have to execute a workflow from a shell script, somebody know how can i do? . thanks for your help!!!!

    hello all, i have to execute a workflow from a shell script, somebody know how can i do? . thanks for your help!!!!

  • How to prevent Automator's "run shell script" to create fully decomposed forms of my strings ?

    I am using Automator's "run shell script" and I am seeing that it outputs fully decomposed forms of my strings.
    For example, when I set the action to "echo été" in a service (with "Replace selected text" activated) and run that into a Textwrangler window, I'll get fully decomposed forms that Textwrangler won't understand. But when I simply type that command into Terminal, I get my string in composed form.
    The problem is not the display issue, but the fact that if I want to run grep for example in "run shell script", I will not be able to find the proper strings since the forms are different.

    Originally I was using $@ to parse a string and get the result pasted by the service. That was a while ago. There, I noticed that some Japanese characters were messed up. Basically all the kana characters that come with voicing markers like が-ga (instead of か-ka) etc. I did not have the time to pursue that issue though.
    Then, last night, I found that a colleague of mine had tried to use $@ to feed to a local dictionary application called ding (http://ftp.tu-chemnitz.de/pub/Local/urz/ding/). His problem was with characters that had umlauts. After verifying how he wrote his action I remembered that I had similar issues with Japanese.
    Basically his command was "/path/to/ding $@"
    That's supposed to use the selected string as an argument to pass to ding, which will launch a Wish application where the string is used as the searched item.
    From Terminal, that works a treat. But the exact same line in Automator (with input as argument, not as stdin) messed the composition and the resulting string was not recognized by ding as a match to what it was supposed to match.
    So, I tried a few things to get to the core of the issue and found that a simple "echo [accented characters]" was enough to reproduce the difference in string handling between Automator and Terminal. That difference is also reproduced on a number of person's machines.
    I have a number of services that basically revolve on "run shell script" actions and involve 3rd party application outputs, preference files etc. so it would not be convenient to show that to you.
    I have sent a mail about this issue to the automator list yesterday too:
    http://lists.apple.com/archives/Automator-users/2011/Jun/msg00004.html

  • How to pass video file name to run shell script

    Trying to make an automator script that will 1. Start a video capture, 2. Stop video capture, 3. Rename video, 4. Run Shell Script. Here is the shell script:
    for f in "$@"
    do
    echo "$f"
    /usr/bin/podcast --server my.podcast.server --user myself --pass mypass --submit --file $f --workflow "my workflow" --metadata /path/to/file
    done
    Question:
    Do I need to create a variable in the automator script to pass it to the script? If I need the variable do I also need to use both Set Value of Variable and Get Value of Variable? If I don't need a variable does $f need quotes around them?

    I'm not familiar with the terminal command /usr/bin/podcast so I don't know what it does but what i said is correct. to pass a file to this action you don't need any variables. the previous action in the workflow should output the video file you want to process, that's all. how you arrange that is up to you. it's clear that you have to fill in appropriate things in that shell script like " my workflow" and path to metadata. But if you have questions about how this shell action works you should ask people who made it.

  • Automator: running forever after executing a shell script?

    Hi,
    so i have found this little automator workflow that will start MAMP's Apache & MYSQL servers automatically (saved workflow as app then put into my login item autostart) however the script just keeps running forever and never exits (which should prompt a small Growl notification as feedback.
    The Script:
    <pre class="jive-pre" style="white-space:pre-wrap;width:585px;">
    on run {input, parameters}
    *do shell script* "/Applications/MAMP/Library/bin/apachectl start" password "my_password" user name "jannis" with administrator privileges
    *do shell script* "/Applications/MAMP/Library/bin/mysqld_safe --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --lowercase_tablenames=0 --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysqlerrorlog &"
    *do shell script* "exit 0"
    return input
    end run
    </pre>
    This is what shows when it runs:
    Any ideas on what I am doing wrong for it to just keep spinning the little cog wheel and not exiting?
    PS: Both services are being started successfully! So the shell scripts seem to be run and doing their job just fine, just that they do not exit.
    Thanks for looking.
    Jannis

    This is a common question with do shell script. The issue is that mysqld_safe doesn't exit until MySQL shuts down, so your do shell script is hanging around waiting, essentially hanging your workflow.
    The solution is to redirect the stdout and stderr of the mysqld_safe command to a temp file. This releases the hooks that do shell script has on the command allowing the workflow to continue. To do this, just append '> /dev/null 2>&1' to the end of the shell command, like:
    do shell script "/Applications/MAMP/Library/bin/mysqld_safe --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --lowercase_tablenames=0 --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysqlerrorlog >/dev/null 2>&1 &"
    As an aside:
    do shell script "exit 0"
    This line is worthless. I'm not sure what you're trying to achieve here

  • Automator shell script won't run

    Hi,
    I'm putting together a little Automator app that opens whenever I double-click on an .exe file and opens that file with wine. So far, however, I've had little luck. I've created a shell script automator app with the following script:
    for f in "$@"
    do
              /usr/local/bin/wine "$f" &
    done
    Outside of Automator the script works just fine. However, as an Automator app it doesn't work at all; nothing happens, even though Automator tells me that that the workflow was successfully completely. What am I doing wrong?
    Thanks,
    Alex

    Automator uses /bin/bash as the shell.
    Running your script interactive has a different environment from running under Automator.  For one thing, stdin/stdout/stderr are pointing to a tty (actually a pseudo device /dev/pty).  Perhaps this is affecting how Wine us behaving.
    Other issues might be where your current working directory is located, or some environment variable (such as PATH) that is not the same under Automator that exists when running interactively.
    You might try capturing things like
    ( printenv
      pwd
      id -a
      echo "\$# $#"
    ) >/tmp/automator.environment

  • Trouble using Run Shell Script with python in Automator

    Hi. I have a python script I want to run in Automator (update_puzzles.py). All it does is check, rearrange and update files and there is not supposed to be any input. I can get the script to run outside of Automator, in Terminal, by navigating to the right directory and typing "python update_puzzles.py"
    I must not be setting up Run Shell Script correctly. I have it set to /bin/bash and Pass Input to stdin. The command line simply reads python /pathname/update_puzzles.py (where pathname is the path to the .py file, which I got by dragging the file onto the Run Shell Script command window). There are no actions before this in my workflow and the action after is View Results.
    The log says Run Shell Script failed, and the error is "Traceback (most recent call last):"
    Any suggestions?
    Thanks so much.

    If the script is expecting to do stuff with files in the same directory as the executable, you will probably need to add a statement to change to the appropriate working directory. The shell used in the Automator *Run Shell Script* action is a generic one that does not share any of the environment variables that the Terminal uses.

Maybe you are looking for

  • Purchased a Movie, which has just disappeared - PLEASE HELP!!!

    I really need some help here please, A few hours ago, I purchased a Movie from the iTunes store which took 3 hours to download to my iPod touch which cost £6.99. A soon as it finished, I took then plugged it into my PC to transfer the purchase to my

  • Startup Disk menu can no longer detect the hard drive

    I am trying to boot my dvd from the startup disk menu (the screen when you press alt and brings up Mac or Windows) as Paragon CamptuneX has adjusted my directory files when I expanded the partition size and it is required to boot from the windows DVD

  • Adobe Acrobat 9.0 - PDF form to email

    I have created an employment application form that I would like to post on our website and have the applicants email back to us. Is it possible to with Adobe Acrobat 9.0 and the submit button? I have tried this but I think I am missing something.  I

  • Servlet cannot invoke package classes

    I have two class which is authenticateController and userAuthentication store in authencation package with path WEB-INF/class/authentication/. My jvm is unable compile authenticateController in authentication directory but it is not problem in path W

  • Offline Mail actions "undone"

    I get the following message in a dialogue: Some actions taken while the account XYZ was offline could not be completed online. ... Mail has undone actions on some messages ... Apple Mail To Do <blah blah> (I'd love to attach a screen shot but that do