How does one run a shell script at system startup?

Hi,
I am trying to unmount my Boot Camp hard drive on my MacBook Pro. Now what I could do is create an automator action, save it as an application and then put it into my user´s login items. I am wondering though - shouldnt it be possible to run a simple shell script command like +diskutil unmount /Volumes/"Boot Camp"+ sometime during the startup process?
Or to put it another way - is there an easy way to do this or do i have to create an manage a daemon through launchd ?
Your help is very much appreciated.

sorry I forgot to mention that there is a bug in Lingon which creates a plist incorrectly if you enter your script explicitly on line 2. At least I haven't been able to make it work. A workaround I always use it the following.
Save your script as a *plain text* file from your favorite text editor. change the extension to .sh and make the file unix executable. Now, when you ccreate a launch daemon using Lingon, enter the path to that file instead of the script itself.
This always works for me.
Good luck!

Similar Messages

  • 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

  • Need steps to run a shell script at solaris startup

    Hi Forum,
    I have a simple script which need to get executed at the time of solaris 10 system startup. Can any one tell me procedure to make the script run at startup in solaris 10 sparc systems.
    Regards
    Prakash

    The best way is to setup a SMF manifest so that the svc process can handle your program. The easiest way however is to simply put the script within the legacy init.d structure. Check out /etc/init.d and the README file in there. Also be sure to look into the init.d(4) manualpage.
    Easiest way IMO.

  • How does one run a *.exe with a Java program?

    Hi,
    I'm looking for a way to run an executable (*.exe) or batch file (*.bat) from within a Java program.
    Any suggestions, leads, or examples appreciated.
    Thanks!

    Runtime.getRuntime.exec("pathTo/yourapp.exe");
    For any type of interpreted scripts, the interpreter should be added:
    Runtime.getRuntime().exec({ "command.com", "mybat.bat"});
    or
    Runtime.getRuntime().exec({"/bin/sh", "configure.sh"});

  • How do I run a shell script as a different user

    I'm setting up a daily.local file to put in the /etc directory. This file will then be run as root but the file contains a script that must be run as a different user.
    Here's what I've tried.
    su - differentuser path/to/script/script.sh parameter1 parameter2
    I'm getting an error with the script because the parameters are not being passed. The script worked fine in 10.4.11 Server but 10.5.8 Server doesn't like it.
    Any ideas?
    Thanks
    Bart

    I'm setting up a daily.local file to put in the /etc directory. This file will then be run as root but the file contains a script that must be run as a different user.
    Here's what I've tried.
    su - differentuser path/to/script/script.sh parameter1 parameter2
    I'm getting an error with the script because the parameters are not being passed. The script worked fine in 10.4.11 Server but 10.5.8 Server doesn't like it.
    Any ideas?
    Thanks
    Bart

  • How do i run  a shell script?

    Hi,
    i am attempting to update some source packages to the latest up-stream version to eliminate a compile time error described at  http://permalink.gmane.org/gmane.os.apple.fink.devel/21842
    but i am having trouble applying the solution. regretably i have little expierience with this sort of scripting dispite allot of expierience in coding C/C++.
    How do i apply this solution please?
    Thank you,

    Hi,
    i am attempting to update some source packages to the latest up-stream version to eliminate a compile time error described at  http://permalink.gmane.org/gmane.os.apple.fink.devel/21842
    but i am having trouble applying the solution. regretably i have little expierience with this sort of scripting dispite allot of expierience in coding C/C++.
    How do i apply this solution please?
    Thank you,

  • How to run a shell script from the GUI?

    This is probably a dumb question...
    How do I run a shell script from the GUI? I've been told to double click it but when I do, it opens as a text file.

    The behavior you describe is that used by the KDE and GNOME desktops of Linux.
    Under OS X, if you make a script then mark it as executable, double-clicking on it in the Finder will not execute it. Actually, it uses a rather complex algorithm ([summarized here|http://arstechnica.com/reviews/2q00/macos-qna/macos-x-qa-2.html]) to determine what to do with it. This is implemented in Mac OS X' LaunchServices framework (incidentally, the associations are cached in /Library/Caches/com.apple.LaunchServices*.csstore and ~/Library/Caches/com.apple/LaunchServices*.csstore). You can read the details in the developer docs about LaunchServices.
    Anyway, in short, the suffix '.command' is a built-in type in the LaunchServices network that identifies a shell script. If you run
    /System/Library/Frameworks/ApplicationServices.framework/Frameworks/LaunchServic es.framework/Support/lsregister -dump
    ... it will tell you as much.

  • Running a shell script through java

    Hi all,
    I have a simple question here.
    How can I run a shell script through java and put the text output into a string.
    I'd be very grateful if you could show me sample code...
    Have a great day,
    Pesho

    Runtime.exec()
    There are plenty of examples. Read the following before continuing, however, as it will save alot of headaches:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • How I run a shell script from the scheduler on 10.2.0.2.0 ?

    Hello Oracle People,
    I'd like to run a shell script from the Scheduler in my 10g database.
    Right now it is a simple shell script.
    Eventually it will wrap RMAN commands to back up my DB.
    I wrote a simple pl/sql script to create a job:
    -- cr_job10.sql
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
    job_name => 'my_backup_job',
    job_type => 'EXECUTABLE',
    job_action => '/h/oracle/scripts/tst.sh',
    start_date => '06-SEP-07 5.33.00PM US/Pacific',
    repeat_interval => 'FREQ=DAILY',
    end_date => '08-SEP-07 4.00.00PM US/Pacific',
    enabled => TRUE,
    comments => 'My Backup Job');
    END;
    I see no errors when I run the above procedure.
    I checked DBA_SCHEDULER_JOBS and the job is in there.
    The scheduler, though, errors out with an error which I see in a trace file:
    /h/oracle/admin/orcl/bdump/orcl_j000_22396.trc
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    ORACLE_HOME = /h/oracle/product/10r2
    System name: SunOS
    Node name: sol
    Release: 5.10
    Version: Generic_118855-14
    Machine: i86pc
    Instance name: orcl
    Redo thread mounted by this instance: 1
    Oracle process number: 15
    Unix process pid: 22396, image: oracle@sol (J000)
    *** ACTION NAME:(MY_BACKUP_JOB) 2007-09-06 17:33:00.175
    *** MODULE NAME:(DBMS_SCHEDULER) 2007-09-06 17:33:00.175
    *** SERVICE NAME:(SYS$USERS) 2007-09-06 17:33:00.175
    *** CLIENT ID:() 2007-09-06 17:33:00.175
    *** SESSION ID:(140.13520) 2007-09-06 17:33:00.175
    *** 2007-09-06 17:33:00.175
    ORA-12012: error on auto execute of job 53267
    ORA-27369: job of type EXECUTABLE failed with exit code: 274662
    I googled on this:
    ORA-27369: job of type EXECUTABLE failed with exit code: 274662
    Google returned only 1 hit.
    There, I see some evidence that I need to configure something inside
    of Oracle to run shell scripts from the scheduler, but possibly just
    for machines running windows. I'm running Solaris.
    Do any of you know what I need to configure inside of Oracle to
    run shell scripts from the scheduler?
    -Owen

    Hello people,
    I should have added this bit of information:
    "The script runs fine from oracle's crontab."
    "The script runs fine from a shell owned by oracle."
    I'm getting responses telling me to check my env variables and permissions
    which would be helpful to a UNIX novice.
    I have a feeling that no one is using the scheduler to run RMAN scripts.
    Tim Hall suggested I take a close look at these files:
    $ORACLE_HOME/rdbms/admin/externaljob.ora
    $ORACLE_HOME/bin/extJob
    Currently I'm setup like this:
    bash sol root /h/oracle/product/10r2/bin 31 #
    bash sol root /h/oracle/product/10r2/bin 31 # ll $ORACLE_HOME/rdbms/admin/externaljob.ora
    -rw-r--r-- 1 root dba 52 Sep 7 15:29 /h/oracle/product/10r2/rdbms/admin/externaljob.ora
    bash sol root /h/oracle/product/10r2/bin 32 #
    bash sol root /h/oracle/product/10r2/bin 32 # cat $ORACLE_HOME/rdbms/admin/externaljob.ora
    # externaljob.ora
    run_user = rman
    run_group = rman
    bash sol root /h/oracle/product/10r2/bin 33 #
    bash sol root /h/oracle/product/10r2/bin 33 #
    bash sol root /h/oracle/product/10r2/bin 33 #
    bash sol root /h/oracle/product/10r2/bin 33 # ll $ORACLE_HOME/bin/ext*
    -rwsr-x--- 1 rman dba 30388 Sep 21 2006 /h/oracle/product/10r2/bin/extjob*
    -rwsr-x--- 1 rman dba 30392 Sep 21 2006 /h/oracle/product/10r2/bin/extjobo*
    -rwsr-x--- 1 rman dba 34468 Sep 21 2006 /h/oracle/product/10r2/bin/extproc*
    -rwxr-xr-x 1 oracle dba 300 Sep 21 2006 /h/oracle/product/10r2/bin/extusrupgrade*
    bash sol root /h/oracle/product/10r2/bin 34 #
    bash sol root /h/oracle/product/10r2/bin 34 #
    bash sol root /h/oracle/product/10r2/bin 34 #
    On my system, the user 'nobody' has no shell so I cannot use nobody.
    I created a user named rman:
    bash sol root /h/oracle/product/10r2/bin 34 #
    bash sol root /h/oracle/product/10r2/bin 34 #
    bash sol root /h/oracle/product/10r2/bin 34 # su - rman
    Sun Microsystems Inc. SunOS 5.10 Generic January 2005
    $
    $ id
    uid=220(rman) gid=220(rman)
    $
    $
    $ date
    Fri Sep 7 16:30:03 PDT 2007
    $
    $
    Jared points out that rman needs access to extproc:
    $ ls -la /h/oracle/product/10r2/bin/extproc
    -rwsr-x--- 1 rman dba 34468 Sep 21 2006 /h/oracle/product/10r2/bin/extproc
    $
    $
    Here is a demo of rman running his script:
    bash sol root /h/oracle/product/10r2/bin 35 # su - rman
    Sun Microsystems Inc. SunOS 5.10 Generic January 2005
    $
    $
    $ ls
    scripts
    $
    $
    $ scripts/tst.sh
    $
    $
    $ cat scripts/tst.sh
    #! /bin/sh
    /usr/bin/date > /tmp/tst.sh.out.txt 2>&1 &
    exit 0
    $
    $
    $ cat /tmp/tst.sh.out.txt
    Fri Sep 7 16:31:23 PDT 2007
    $
    $ rm /tmp/tst.sh.out.txt
    $
    I am focused on this error:
    ORA-27369: job of type EXECUTABLE failed with exit code: 274662
    And I am focused on this exit code: 274662
    What does 274662 mean?
    If the Scheduler gives me an error like "274662" rather than some English,
    it's obvious to me the Scheduler is a POS and I should not use it.
    And of course,
    If I cannot run RMAN from Oracle Scheduler, I'll use cron.
    -Owen

  • How to run unix shell script from java web applet

    hi all
    i have created one java applet. my apache web server is on unix server.
    i have created one shell script in same directory where my .class and .htm files reside...
    how to run this shell script from applet? it should search this .sh file on server and not on the client browser machine...
    thanks in advance

    I suppose you could make the shell script into a CGI, configure the server to execute CGIs, and then make the applet open the URL of that CGI.

  • Firefox update installs, but does not apprearon screen, or task manger yet is running what is going on and how does one fix it?

    I installed the update Mozilla Firefox 28. It was suppose to launch upon completion. it did not appear on the monitor screen, nor the task manager, but was running; for when I attempted to install the older version again it, it said that Firefox was running and needed to be turned off.
    I restarted the computer and tried opening Firefox, with the same results.
    After restarting again, I attempted to reinstall the update, with the same results taking place.
    I attempted to uninstall Firefox and install the new version. The same results took place.
    In the past, I could install Firefox 27 update, only now I can't for the same thing takes place. Past a certain version (19), this event takes place, but 19 and older can install it with no problems.
    I checked Firefox troubleshooting information. All was normal. I checked my firewall. Again, all was normal. Tried Firefox reset. Did not help. Tried with my firewall disabled. Did not solve the problem.
    Ran a virus check (deep) no viruses. Checked my computer system. No errors.
    I can install updates for my other programs, even install new programs; just not Firefox.
    What is going on and how does one fix it.

    Hi Amseeking,
    Thank you for your question. From your description, you tried to install the 28 update from a version 19 installation. Did you install a fresh install of 28 successfully? Where the name of the file is"Firefox Setup Stub 28.exe"? This is what is sound like happened. When going to about Firefox and searching for updates it installs over the current installation. However if Firefox was already running, there are more than one installation.
    Updating from version 19 to 28 would not be a problem. However the user data from your previous version would have to be imported to the new installation if you have more than one install on that computer.
    An easy way to tell is to search for Firefox in the Start menu to see if more than one icon shows up in the search results.
    I hope this helps.

  • How does one continue to use Mail on the early MacBook Pro, Model 1,1, that is not upgradable to Lion?  I have been running iCloud on my iPhone (OS5) and iMac (Lion) along with the MacBook Pro (OS Version 10.6.8)

    How does one continue to use Mail on the early MacBook Pro, Model 1,1, that is not upgradable to Lion?  I have been running iCloud on my iPhone (OS5) and iMac (Lion) along with the MacBook Pro (OS Version 10.6.8) since November until now.  Mail will no longer download on the MacBook Pro and keeps asking for my password.

    Mail should still be usable with your machine - but you'll need to update the settings to conform to the requirements of your system. Check with your ISP (like ATT, etc.) for the settings that will work with your Mail. Once you've updated this, you should be able to email like before.
    For example, my ISP required that I go to Mail Preferences/Accounts and make sure the details conform to your email settings.
    I have no idea of what your ISP is or what the settings might be, but this is likely the source of the problem.

  • 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

  • How does one install a express sql server to run with Visual Web Developer 2008?

    I successfully installed .NET framework v 3.5 and VWD 2008 on a new Vista laptop. When I want to add a Sql Server database to a website, errors tell me to install SS 2005 Express. MSDN SS 2005 Express download tells me I MUST  first install .NET framework v 2.0 before SS 2005. When I try to install framework v 2.0, I'm sent to v. 3.5 and no way to download SS 2005.
    How does one install a express sql server to run with Visual Web Developer 2008?   

    Momark,
    Do you still need help with this?
    Thank you!
    Ed Price, Power BI & SQL Server Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • How does one tell if the J2EE services are running with Unlimited

    How does one tell if the J2EE services are running with Unlimited
    security? We have applied the export Policy to the server but we do notsee any reference to it running with it. .we apply the Service packs SAP now upgrades that JAVA as well . Do that process treat the JAVA
    lib/security area correctly.

    Just out of curiosity... Is there something you do
    like about Mac/Apple?
    To answer your question: no, not really. However, the points that I made here were about Safari and accompanying utilities, not about Apple in general.
    If it makes you feel any better, I am just as, or even more, critical of Micro$oft as the occasions arise...Windoze Vista is the most recent occasion and has given sufficient reasons and opportunities to vent my spleen that I actually have eased up on Apple, politicians, nut-case religious extremists, cell phone owners, and the Department of Homeland Paranioa, etc., due to an exhaustion of creative energy.

Maybe you are looking for

  • Void warranty

    i encountered this problem this afternoon. i went to a power mac service center and then when they did the check up on the phone they said that there's something missing. they call it "bracket" but i didn't go to someone to fix my phone. this is my f

  • I am getting a "printing error" message on my Pixma M432 and a lightening icon at the right

    I am getting a "printing error" message on my Pixma M432 and the lightening shaped icon in the triangle beneath the stop button is flashing.  My documents won't print and are backed up onscreen on my computer.  I have turned it off and on. What is wr

  • Recurring Inspection Error.

    Dear Friends, I have a problem: A Batch is posted in QI (Qnty:300gm) for recurring inspection lot. Now according to the inspection plan for the inspection lot is having sample size 500gm i.e. greater then the lot size. ow the system is not allowing m

  • IPhone sync notes/todo

    I'm currently researching methods of keeping notes/to-do/calendar synchronized across my iPhone and arch desktop. I'm quite fond of the ncurses programs, if there are any suggestions that'd be great. I'm looking to see what the other iphone users hav

  • Weather Widget Has Stopped Updating

    Last week I started transitioning from a satellite internet connection to a wisp (wireless isp). When I am connected to the satellite connection, the weather widget updates when I bring up the widgets on my screen. When I am connected to the wisp, it