How to Make Automatic Running Program?

Discussion in 'macOS' started by jauhari, Jan 1, 2008.

  1. jauhari macrumors regular

    jauhari

    Joined:
    Mar 20, 2007
    #1
    I have installed XAMPP and running with Perfect, but I have little bit question. I want make my XAMPP (Apache and Mysql) Every Time I turn on my Mac OSX Leopard.

    How to add this line to my Mac OSX Leopard startup

    Code:
    /Applications/xampp/xamppfiles/mampp startapache
    /Applications/xampp/xamppfiles/mampp startmysql
    Please Help me
     
  2. CaptainZap macrumors regular

    Joined:
    Jan 17, 2007
    #2
    You could put that into a shell script and then make an Automator Application that runs that shell script, then add it to your login items.
     
  3. WildPalms macrumors 6502a

    WildPalms

    Joined:
    Jan 4, 2006
    Location:
    Honolulu, HI
    #3
    ...or skip the Automator section and add the shell script directly to your login items.
     
  4. CaptainZap macrumors regular

    Joined:
    Jan 17, 2007
    #4
    Really that will work? Awesome, didn't know that.
     
  5. WildPalms macrumors 6502a

    WildPalms

    Joined:
    Jan 4, 2006
    Location:
    Honolulu, HI
    #5
    Yep, just have to navigate to the shell script and ensure it has a suffix of .sh so that Finder knows how to display it.
     
  6. jauhari thread starter macrumors regular

    jauhari

    Joined:
    Mar 20, 2007
    #6
    Can you give me real example? I am still newbie in Mac OSX Leopard, I just switched in early December and Thanks before

    The other problems is, this code must be executed by ROOT. How to do that? so I can hide this startup and running with smoothly.

    Please Help me
     
  7. WildPalms macrumors 6502a

    WildPalms

    Joined:
    Jan 4, 2006
    Location:
    Honolulu, HI
    #7
    In Textedit or in Terminal, create a file in your home directory called xampstart.sh and then go into System Preferences, then Accounts and click on Login Items and add the shell script in there.

    In Terminal:

    1. cd ~
    2. touch xampstart.sh
    3. echo /Applications/xampp/xamppfiles/mampp startapache >> xampstart.sh
    4. echo /Applications/xampp/xamppfiles/mampp startmysql >> xampstart.sh
    5. chmod 770 xampstart.sh

    Then go into System Preferences, click on Accounts, select your username, then click on Login Items, click on the plus symbol (+) and navigate to your home folder and select the xampstart.sh file.

    Just one way ;)
     
  8. jauhari thread starter macrumors regular

    jauhari

    Joined:
    Mar 20, 2007
    #8
    Perfect, how about my other problem? this code must be executed as ROOT.
    Please help

    Thanks
     
  9. jauhari thread starter macrumors regular

    jauhari

    Joined:
    Mar 20, 2007
  10. Mal macrumors 603

    Mal

    Joined:
    Jan 6, 2002
    Location:
    Orlando
    #10
    Just add sudo to the beginning of each line, or on the line before, "login root" (obviously without the quotes). Of course, either way, you'll have to type your password, no way of getting around that AFAIK (and that's probably a good thing).

    jW
     

Share This Page