Help 'Exiting' after Automator Shell Script Execution

Hello,
I've recently installed and got running GCalDaemon (http://gcaldaemon.sourceforge.net/) which allows me to Synch Rainlendar <-> Google Calendar through iCal (You can also synch iCal <-> Google Calendar). I needed to start up a shell script/applescript after each startup/login in order for GCalDaemon to start the synching process each time and continue to do so at the timed intervals. I would do so by the following terminal code:
cd /usr/local/sbin/GCALDaemon/bin
./standalone-start.sh
I then tried automating this process and came across shell script execution through Automator. I did so and created a .app with the above mentioned code. This works and it starts up the necessary .sh file I need and the snyching works under StartUp. My concern is however, how do I exit terminal once the code has executed the necessary file? All I have in my .app is the above mentioned code for now. I just need it to exit terminal because on startup or after starting the program, I get this issue (See Attachment)
This continues to run, so my guess is that I need to add code to exit terminal and allow the .app to close itself properly after doing so.
Please guide me in the right direction.
Picture Belows shows what happens when I run the Automator App. It continues to run until I quit out of the app manually (TheGCal programs works fine though). I feel I need to have app quit Terminal or fully end the process and quit out on it's own.
Thanks
<table style="width:auto;"><tr><td></td></tr><tr><td style="font-family:arial,sans-serif; font-size:11px; text-align:right">From GCalDaemon</td></tr></table>

i redirected the command output to /dev/null which is unix equivalent of a black hole and I also redirected error output to standard output in case the script produces any errors.
also & at the end tells it to continue without waiting for the script to finish.
Message was edited by: V.K.

Similar Messages

  • Error with dbms_scheduler and shell script execution

    Hi,guys.
    I have an issue with a dbms_scheduler and a shell script execution. So, the shell script as it self works fine, when i'm executing ./test.sh all process is running, but when i'm executing the script from dbms_scheduler it just simply doesn't work. Actually it works, but some of executable information in sh doesn't work, seems it just jump over of the part of the script. Sendmail part is running, maybe there is problem with rman script as it self?
    DB version: 10g
    And my scripts:
    Shell scripts (permisons 755):
    #!/bin/ksh
    export PATH=/home/oracle/product/asm_home/bin:/home/oracle/product/db_home/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/oracle/bin:/usr/bin/X11:/sbin:.
    export ORACLE_BASE=/home/oracle/product
    export ORACLE_SID=zabbix
    export ORACLE_HOME=/home/oracle/product/db_home
    ${ORACLE_HOME}/bin/rman<<EOF
    connect target /
    run {backup recovery area delete all input;}
    EOF
    {       echo "From:[email protected]"
            echo "To: [email protected]"
            echo "Subject: Recovery area"
            echo 'Content-Type: text/html'
            echo
            echo '<html><body><table border="1" cellspacing="1">'
            echo '<tr><td><b>Process</b></td><td><b>Statuss</b></td></tr>'
            echo "<tr><td>RMAN</td><td><b>Works</b></td></tr>"
            echo "</table></body></html>"
    } | sendmail -tIn the first part i'm exporting all of the important stuff for oracle, then I call RMAN with specific atributes. And then there is just simply sendmail functionality inside script to represent if script works (for now).
    And below pl/sql script:
    begin
      DBMS_SCHEDULER.CREATE_JOB
      job_name => 'FLASH_RECOVERY',
      job_type => 'EXECUTABLE',
      job_action => '/home/oracle/backup/test.sh',
      start_date => sysdate,
      job_class => 'DEFAULT_JOB_CLASS',
      enabled => TRUE,
      auto_drop => FALSE,
      comments => 'FLASH RECOVERY USAGE AREA backup and delete'
      END;
      /And this job execution:
           begin
               DBMS_SCHEDULER.run_job (job_name =>'FLASH_RECOVERY',use_current_session => TRUE);
           end;What can be wrong? For me, I think it's something with permisions.
    I hope you got my idea and could help me.
    Tom
    Edited by: safazaurs on 2013.18.2 22:16

    There is no error, i just receive all the time e-mail, seems it jumps over rman. I tried almost everything and still couldn't get result as i want. And, if i'm running script from command line - it works. Rman calls, and starts to recover archivelogs.

  • Need Help in creating Unix Shell Script for database

    Would be appreciable if some one can help in creating unix shell script for the Oracle DB 10,11g.
    Here is the condition which i want to implement.
    1. Create shell script to create the database with 10GB TB SPACE and 3 groups of redo log file(Each 300MB).
    2. Increase size of redolog file.
    3. Load sample schema.
    4. dump the schema.
    5. Create empty db (Script should check if db already exists and drop it in this case).
    6. Create backup using rman.
    7. restore backup which you have backed up.

    This isn't much of a "code-sharing" site but a "knowledge-sharing" site.  Code posted me may be from a questioner who has a problem / issue / error with his code.   But we don't generally see people writing entire scripts as responses to such questions as yours.  There may be other sites where you can get coding done "for free".
    What you could do is to write some of the code and test it and, if and when it fails / errors, post it for members to make suggestions.
    But the expectation here is for you to write your own code.
    Hemant K Chitale

  • Trouble running automator shell script

    This is probably going to be an really simple fix, but I'm have trouble building an automator service that runs a bash shell script. All of the elements of the script work fine when plugged into shell, but for some reason the automator service is failing to run. The script calls ffmpeg to convert an audio file:
    for f in "$@"
    do
      fn="${f%%.*}"
      /Users/aa/Applications/ffmpeg/ffmpeg -i "$f" -acodec libmp3lame -q:a 7 -ar 8000 -ac 1 "$fn.mp3"
    done
    The script runs fine without the ffmpeg command, and the ffmpeg command runs fine in the terminal on its own. Where's the error coming from?
    Thanks!

    The first is what I'm getting from the bash terminal execution, the second from automator. I'm accenting the differences I see. Thanks for the help!
    ----bash----------------------------------------
    drwxr-xr-x@ 67 aa  staff  - 2278 Apr  6 07:42 .
      com.apple.progress.fractionCompleted  14
    0: group:everyone deny delete
    uid=501(aa) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81( _appserveradm),98(_lpadmin),33(_appstore),100(_lpoperator),204(_developer),398(c om.apple.access_screensharing),399(com.apple.access_ssh)
    0
    -bash
    TERM_PROGRAM=Apple_Terminal
    SHELL=/bin/bash
    TERM=xterm-256color
    TMPDIR=/var/folders/x9/y4r_w7gj4_j_3wkfxn6s6fqm0000gn/T/
    Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.oSzc5cau0v/Render
    TERM_PROGRAM_VERSION=343.6
    TERM_SESSION_ID=AF09D92C-2CB4-4069-A172-0DE12EB226BD
    USER=aa
    SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.RFhFIs94Ad/Listeners
    __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
    PATH=/Applications/anaconda/bin:/Applications/anaconda/bin:/Applications/anacond a/bin:/Users/aa/anaconda/bin:/Applications/anaconda/bin:/Applications/anaconda/b in:/Applications/anaconda/bin:/Applications/anaconda/bin:/Library/Frameworks/Pyt hon.framework/Versions/3.4/bin:/Applications/anaconda/bin:/Users/aa/anaconda/bin :/Applications/Anaconda/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbi n:/opt/X11/bin:/usr/local/git/bin:/usr/local/MacGPG2/bin:/usr/texbin
    PWD=/Users/aa
    LANG=en_US.UTF-8
    XPC_FLAGS=0x0
    XPC_SERVICE_NAME=0
    SHLVL=1
    HOME=/Users/aa
    LOGNAME=aa
    DISPLAY=/private/tmp/com.apple.launchd.YewceoE69R/org.macosforge.xquartz:0
    _=/usr/bin/printenv
    ----automator----------------------------------------
    /Users/aa
    drwxr-xr-x@ 66 aa  staff  - 2244 Apr  6 07:42 .
      com.apple.progress.fractionCompleted  14
    0: group:everyone deny delete
    uid=501(aa) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81( _appserveradm),98(_lpadmin),33(_appstore),100(_lpoperator),204(_developer),398(c om.apple.access_screensharing),399(com.apple.access_ssh)
    0
    SHELL=/bin/bash
    TMPDIR=/var/folders/x9/y4r_w7gj4_j_3wkfxn6s6fqm0000gn/T/
    Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.oSzc5cau0v/Render
    USER=aa
    SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.RFhFIs94Ad/Listeners
    __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
    PATH=/usr/bin:/bin:/usr/sbin:/sbin
    PWD=/Users/aa
    XPC_FLAGS=0x0
    XPC_SERVICE_NAME=0
    SHLVL=1
    HOME=/Users/aa
    LOGNAME=aa
    DISPLAY=/private/tmp/com.apple.launchd.YewceoE69R/org.macosforge.xquartz:0
    _=/usr/bin/printenv

  • Shell script execution from stored procedure

    I am working on a project thallt requires a shell script be executed upon the execution of a stored procedure with Oracle 10g. I have researched the matter, but there does not seem to be much out there on how to execute lines of UNIX commands by use of a stored procedure. If anybody has ever gotten this to work, any information would be appreciated. If the task is impossible, let me know, I just could not confirm that it was not something that could be done.

    A combination of things can help you out here - none of which are easy or particularily secure.
    1) From plain PL/SQL, you can call 'external procedures'. That is basically a DLL or .so that the listener can load on demand, and that external procedure (EXTPROC) can run whatever you need from the C program. C can, in turn, call a shell.
    This is fairly well documented, but be aware that 1/2 of the info is in the PL/SQL docco and the other half in the Networking docco.
    A fair bit of info is available in metalink as well - if you have access, simply search on extproc.
    2) You can call a Java stored procedure which in turn has hooks to the outside world. That will probably require a PL/SQL to Java wrapper to make it available in your environment. Oracle has been using this one successfully for a while.
    3) Write the script using UTL_FILE and have a daemon look for, and execute, the script.
    4) Since you are using 10g, use the new job scheduler. It has excellent capability to interact with the OS, and it is available as a PL/SQL package (DBMS_SCHEDULER). I find the interface a bit heavy, but that could be wrapped by a library tailored to your specific needs.
    Let us know what you decide to do in the end (and why) - it is an interesting topic.

  • Automator Shell Script

    Hi,
    I am very new to Automator and know the very basics about Unix but use Terminal frequently for very repetitive tasks (which I usually find on the web) - one of which is creating MD5 of all files within a specific folder. To achieve this I generally open Terminal, go to a specific project folder and enter: find . -print0 | xargs -0 -I{} md5 "$@"{} >> md5.chk
    This then creates a txt file called md5.chk within the folder which lists all off the files within that folder (with file path) as well as all the the associated checksums for these files.
    I would like to streamline this process a little by creating a service with Automator so I can select a Folder within Finder and select the require Service.
    Unfortunately I am not getting very far. This is where I am:
    1. Open Automator and select Service
    2. Add "Get Specified Finder Items" action
    3. Add "Run Shell Script" action (Pass input: as argument) with the following: find . -print0 | xargs -0 -I{} md5 "$@"{} >> md5.chk
    Unfortunately this doesn't achieve the required result. I presume there are some elements within the shell script that I am simply missing. Can anyone help?
    Thanks

    This is a test. It is ONLY a test.
    Change your Automator "Run Shell Script" to:
    ( pwd
    echo "+++++"
    /bin/ls -dlae0@ .
    echo "+++++"
    id -a
    echo "+++++"
    echo "number of args: $#"
    echo "+++++"
    printenv
    echo "+++++"
    echo find "$@" -type f -print0
    echo "+++++"
    find "$@" -type f -print0 | xargs -0 -I{} echo "{}"
    ) >/tmp/tmp.txt
    Then look at /tmp/tmp.txt and see if the expanded command look they it should. You can get to the /tmp directory using Finder -> Go -> Go to Folder -> /tmp
    The double-quotes will be missing (as the shell will swallow them), however, what you are interested in is did the "$@" expand to the desired directory.
    The pwd will tell us what the current working directory is. This could be important, as maybe you do not have permissions to use that directory.
    The /bin/ls will tell us the ownership and permissions of the current working directory.
    The id -a will tell us what account the automator script is running as
    The $# will tell us how many arguments were passed as part of the "$@"
    The printenv will tell us what environment variables have been set.
    The find|xargs is changed to replace md5 with echo, so that we can see that the "{}" expanded to.

  • Speed up shell script execution

    Hi All,
    Before I go on, I must stress I am doing this for a disk image that I OWN, it's in no way an attempt to break into someone else's data...
    Last week I created an encrypted disk image (10GB) but have since forgotten the password stupidly!!!
    So, I figured I could knock up an applescript to try and brute force the image.
    I have successfully done this running th following code:
    do shell script "hdiutil attach -passphrase PASSWORDVAR diskimage.dmg
    The PASSWORDVAR changes on every loop to the next consecutive attempt, ie
    aaaaa
    aaaab
    aaaac etc
    When I run the script the command is looping about twice a second which is pretty slow... Is there anyway to speed this up a bit? Any help would be great!
    Thanks,

    You don't show the rest of your script that's building the password to try, so it's possible the problem is there, but the chances are your delay is not in AppleScript, but in hdiutil.
    On its own AppleScript can execute simple loops pretty quickly. However in this case you're calling hdiutil which has to take the parameters, test the password against the disk image, verify the result and then return an error.
    There is some overhead here in AppleScript calling do shell script so you might find better performance if this was a single shell script rather than an AppleScript, but I don't think it'll be a lot different.
    If you have multiple machines you can try to divide and conquer, having each machine start at a different point in the list of possibilities (or one start from the end and work forwards), other than that it's a let-it-run-all-night (week?) kind of thing.

  • Automator "shell script" doesn't work

    Hi,
    I'm trying to build an Automator script in OSX 10.6.4.
    -Get selected items in the finder
    -Execute shell script (arguments)
    cd $(dirname "$1")
    for f in "$@"
    do
    /foo/bar/convert "$f" out.pdf
    done
    If I press the "execute" button, the script seems to work, as shown here: http://i.imgur.com/Nyhcd.jpg
    However, if I try to run the script by right-clicking on a file, a pop up message says that "the execute shell script has encountered an error"
    The "convert" command works flawlessy from a Terminal.app window, and the enviroment is correctly set-up in this way:
    export MAGICK_HOME="/Users/gipinet/image_magik/"
    export PATH=$MAGICK_HOME/bin:$PATH
    export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib"

    Environment variables are NOT global. They are inherited from a parent process as a subprocess is created by that parent.
    .profile is ONLY read by the shell (bash) when you start a Terminal session. So only the shell and any commands it runs will see those environment variables.
    Since you are not running the Automator workflow from a Terminal session, there is no way for Automator to inherit those environment variables.
    So if those environment variables are needed for your convert utility, then you need to make sure that your Run Shell Script needs to get them on its own.
    You could hard code them into your Run Shell Script, or you could source your .profile
    . /User/yourusername/.profile # notice the . which is the /bin/sh 'source' command
    Of course if your .profile has lots of other stuff that will upset the Automator Run Shell Script, then you may not want to do that. For example, if your .profile were expecting things in its environment that ONLY exist in a Terminal session that might upset your .profile when invoked in Run Shell Script.

  • Automator shell script to zip

    I'm trying to follow some advice I found to use an automator Finder Plugin to zip selected files and save the zipped files. It's not working. Here's what I'm doing:
    1) Open Automator
    2) Under Libarary, select Automator.
    3) Drag Run Shell Script to Workflow window.
    4) Leave Shell = bin/bash, make Pass input = as arguments.
    5) Enter code:
    for f in "$@"
    do
    zip -r "$f" "$f"
    done
    6) Save As Pluging. Name = ZipClean, Plug-in for = Finder.
    7) Try it out... no joy. Select one file and right click to Automator -> ZipClean. It seems to go away for a bit of time and come back, but no new zip has been created (really, I searched!).
    I know this is a silly script but if I can get this version to work, I'm going to add -x *.DS_Store -x .svn in order to create zips that are not corrupted by osx and svn invisible files and directories.
    So bottom line... why isn't the zip file being created and stored? When I do this directly in a terminal window it seems to work ok.
    Thanks in advance!
    joe

    If you plug your shell script into Automator and use a Finder action to pass items to it, it works for a folder but fails for a single file. You might need to tweak the parameters for a plug-in - refer to the zip manual page. You can also use ditto (I posted an AppleScript action earlier using ditto in this reply).

  • 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

  • Automator: shell script to change file permissions

    Hey guys,
    Just created a workflow to copy some files from one location to another.
    Second thing I want to do is run a shell-script to set some file permissions recursively, some for the folders, the other for the files.
    I figured I could do the following:
    cd /IntoAFolder
    find . -type d -exec chmod 770 {} \;
    Unfortunately, this seems to be needed to be done as a sudo'er and thus requires the user's password.
    So the question is, how do I get that password and hand it to the shell script or is there another way of doing this?

    What I want to do is recursively chmod the subfolders and files of a "root"-folder.
    The way I know to do so is:
    cd /root-folder
    find . -type d -exec chmod 755 {} \;
    That will chmod all subfolders from the root-folder to 755.
    Next i want
    find . -type f -exec chmod 644 {} \;
    That will chmod all subfiles fromn the root-folder to 644
    Unfortunately, find gives me a permission denied when I run this command from the command-line. When I just manualy chmod everything that works fine but is a bit to much work when it comes down to a tree of 5 subfolders and 120 files.
    Waht basically hapens:
    The user selects a bunch of folders.
    Then they are copied to /Applications/RCT3.localised/Data/Styles/Themed
    and then I need to chmod them just to be sure, as sometimes stuff break along the way if you don't

  • Assistance with Automator Shell Scripting

    Is there a way to take the Ask for text, set the returned value as a variable and use that variable later on in a Shell Script action?
    Thanks in Advance

    This is showing how you would access your variables. $@ will contain all the command line variables and the for do loop intinerates over each one one at a time.
    So you would replace this with your script of course but thats how you would access the arguments.

  • Security Advisory: File Association Meta Data Shell Script Execution

    So upon arriving home and checking my email a family member of mine forwarded an email to me to from from a friend of his. In this email was a link to a blog entry on ZDnet.com containing a story on another Mac OS X security hole.
    The company that has made the advisory is Secunia.
    In my opinion deeming it "extremely critical" is blowing it WAY out of proportion.
    This can be easily circumvented. First though, try out their demonstration that launches the Calculator just by downloading the file.
    If you do receive the behaviour you know what you are doing. If the calculator launched then just go into your Safari preferences and disable "Open "safe" files after downloading".
    15-inch 1.5GHz PowerBook G4   Mac OS X (10.4.5)   1.536GB RAM, 128MB VRAM

    Hi Alexander, go into your Safari preferences and disable "Open "safe" files after downloading".
    Yes this is a good way to help prevent against this "proof of concept", should it ever become more than that.
    Another good idea is to create a seperate keychain and put any sensitive data you have like bank acccount numbers, credit card numbers, critical passwords, etc in a "secure note". You can do this by opening keychain access and choosing File >> New Keychain. Coose name and
    password then, select the keychain and choose File >> New Secure Note Item.
    And yet another, is to open any downloads in TextEdit to view their contents if you aren't sure.
    -mj
    [email protected]

  • Cron job is not working SCP automated shell script

    #!/usr/bin/expect -f
    # connect via scp
    spawn scp "[email protected]:/u04/dumps/test.dmp" /u10/app/
    expect {
    -re ".*es.*o.*" {
    exp_send "yes\r"
    exp_continue
    -re ".*sword.*" {
    exp_send "pwd\r"
    interact
    above is the automated script to download the file from remote server to local server.
    I am trying to download around 2GB file. for that i am using the above automated script. But that script is not working cron service.
    Cron is not executing that script to download the file from Remote server to Local Server.

    Cron is not executing that script to download the file from Remote server to Local Server.That script only or any script ? Did you try with something else ?
    I had a similar problem on a Linux machine, where cron jobs didn't start, and the only solution was to restart cron daemon whenever crontab files were updated.

  • Help on using Textutil shell script

    I remember a very helpful page on the Apple site describing the use of textutil and all its parameters. Now I want to use it again (to rename files), but the help pages seem to have disappeared. I've searched the Apple site and googled all sorts of combinations, but can't find what I'm looking for.
    Can anyone point me to an idiot's guide? It was an amazing tool for concatenating Word docs, and I look forward to using it again....

    Yes, that looks like it - thanks! It's bookmarked now. I thought there were more examples... I also thought I could use textutil to rename files (via Filemaker, using Filemaker to calculate the new file name based on the old one, don't even ask!! - there's only 19000 of them).
    Bit more research called for, but thanks for the link.

Maybe you are looking for

  • Can't see Remote data in Dreamweaver CS4

    I have a site that I have had for years and recently changed from a real old version of Dreamweaver to Dreamweaver CS4.  I had trouble getting my FTP to work so I used an external program to move the files.  The files have been uploaded and the site

  • [AS] Script Label Items in a Group

    Hi all, I have a group of shapes that, when grouped together in Indesign, form an object.  This grouped object is script labeled "special".  I am trying to script label each of the individual parts of this grouped object "special" so that if users ev

  • Sender interface from R/3 6.20 to XI 3.0

    I am trying to get our <b>R/3 6.20</b> back end talking to our <b>XI 3.0</b> environment. I have been successfully making receiver RFC BAPI calls to R/3 as well as plain_http sender and file sender to XI. We need to pass HR/Payroll information from R

  • Can you paste ALL video attributes with one click?

    When copying motion attributes from one clip to another, is there a way of selecting all the video attributes in one shot to paste to the next clip, instead of having to check each individual box in the paste attributes dialogue?

  • Bookmarks list view missing

    I have noticed after the Android 4.0.4 update I cannot see may native browser bookmarks in a list view. All I get are the small icon representations of the website. I would like the bookmarks in list view instead. Another problem after the update goo