Skip to content

Add specjour listen to your boot

pierreozoux edited this page Nov 29, 2012 · 4 revisions

Mac OS

Put this file here : /Library/LaunchDaemons/specjour_listen.plist

<?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>specjour_listen</string>
    <key>ProgramArguments</key>
    <array>
        <string>bundle</string>
        <string>exec</string>
        <string>specjour</string>
        <string>listen</string>
    </array>
    <key>KeepAlive</key>
    <true/>
    <key>EnvironmentVariables</key>
      <dict>
        <key>PATH</key>
        <string>everything that is in echo $PATH</string>
        <key>HOME</key>
        <string>YourHomePath</string>
      </dict>
    <key>RunAtLoad</key>
    <true/>
    <key>WorkingDirectory</key>
    <string>/your/project/directory/</string>
    <key>UserName</key>
    <string>YourUserName</string>
    <key>debug</key>
    <true/>
</dict>
</plist>

Don't forget to replace YourUserName, YourHomePath, EnvironmentVariables and WorkingDirectory. It is an example with bundle exec.

After that, install it : sudo launchctl load /Library/LaunchDaemons/specjour_listen.plist

Gentoo

Add this to the following file /etc/local.d/specjour.start:

#!/bin/bash
sudo -biu deploy bash -c 'cd /path/to/your/project ; bundle exec specjour listen >> /path/to/your/project/log/specjour.log & 2>&1; echo $! > /tmp/temp.pid'
sleep 1
cat /tmp/temp.pid > /var/run/specjour-listen.pid

And make this file executable : chmod 755 /etc/local.d/specjour.start

If you want to stop specjour listen :

Add this to the following file /etc/local.d/specjour.stop:

#!/bin/bash
cat /var/run/specjour-listen.pid | xargs kill
rm /var/run/specjour-listen.pid

And make this file executable : chmod 755 /etc/local.d/specjour.stop

Clone this wiki locally