Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

This question fits somewhere between server fault, stackoverflow and askdifferent.

I am installing some web apps on my Lion server using webappctl, which hooks into apaches vhost configs to setup up a reverse proxy (simply mod_proxy). It uses launchd to start the server, in my case unicorn serving a Ruby on Rails app, listening on TCP port 5000. I use RVM (mixed-mode) to facilitate in separate ruby versions and gemsets for each webapp.

The problem lies with RVM and launchd, and the complete environment not being available for launchd.

I tried to start from launchd using /bin/bash -l -c 'unicorn_rails -l 5000' but that gave me bash usage errors in the logs.

Any suggestions for making RVM play nice with launchd?

share|improve this question
    
This question would get a better response on Superuser –  Graeme Hutchison Dec 13 '11 at 11:40
2  
A lot of Apple related questions are being migrated to Ask Different that really shouldn't be. The level of technical knowledge on Ask Different is low compared to StackOverflow, ServerFault, and SuperUser. Just because it's Apple hardware/software doesn't mean it doesn't belong on those sites! So stop migrating just because some Win or open source troll sees the word Mac –  Meltemi Jan 25 '12 at 18:19
1  
What were the bash errors? –  Mark Nov 30 '13 at 10:47
add comment

migrated from serverfault.com Dec 13 '11 at 11:34

This question came from our site for professional system and network administrators.

1 Answer

I found a way to make a RVM-based rake command work with launchd:

/bin/bash -l -c '/absolute/path/to/myscript.sh'

My script was calling rake. I wasn't calling it directly.

Have you tried using an absolute path for your unicorn_rails?

The .plist looks like:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict>
        <key>Label</key>
        <string>mylabel</string>
        <key>ProgramArguments</key>
        <array>
                <string>/bin/bash</string>
                <string>-l</string>
                <string>-c</string>
                <string>/absolute/path/to/myscript.sh</string>
        </array>
        <key>StartCalendarInterval</key>
        <dict>
                <key>Hour</key>
                <integer>10</integer>
                <key>Minute</key>
                <integer>00</integer>
        </dict>
    </dict> 
</plist>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.