« Newer Snippets
Older Snippets »
4 total  XML / RSS feed 

svnserve launchd item for OS X 10.4

It's not that straightforward getting svnserve to work under launchd. I can't take the credit for this but I thought it would be useful to have it here on TextSnippets.

1) Install subversion if you don't have it already. Here's how with DarwinPorts.

sudo port install subversion


2) Create your Subversion repository (for my own use, I used /Users/xyz/Repositories) e.g.

svnadmin create /Users/xyz/Repositories


3) Place the following XML into a file named org.tigris.subversion.svnserve in the /Library/LaunchDaemons directory.

<?xml version="1.0" encoding="UTF-8"?>
DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Debugkey>
        />
        <key>GroupNamekey>
        xyz</string>
        <key>Labelkey>
        org.tigris.subversion.svnserve</string>
        <key>OnDemandkey>
        />
        <key>Programkey>
        /opt/local/bin/svnservestring>
        ProgramArguments</key>
        <array>
                <string>svnservestring>
                --inetd</string>
                <string>--root=/Users/xyz/Repositoriesstring>
        </array>
        <key>ServiceDescriptionkey>
        SVN Version Control System</string>
        <key>Socketskey>
        
                Listeners</key>
                <dict>
                        <key>SockFamilykey>
                        IPv4</string>
                        <key>SockServiceNamekey>
                        svn</string>
                        <key>SockTypekey>
                        stream</string>
                dict>
        </dict>
        <key>Umaskkey>
        2</integer>
        <key>UserNamekey>
        xyz</string>
        <key>inetdCompatibilitykey>
        
                Wait</key>
                <false/>
        dict>
</dict>
plist>


You'll need to change xyz to your user name ...

4) Test it out by doing a

sudo launchctl load /Library/LaunchDaemons/org.tigris.subversion.svnserve

sudo launchctl start /Library/LaunchDaemons/org.tigris.subversion.svnserve

svn co svn://your.host.name/aModule/In/Your/Repository

Rails MySQL Session Sweeper

1) Download the launchd GUI, Lingon, from: http://lingon.sourceforge.net/

2) Add hourly job:

$RAILS_APP_DIR/script/runner 'ActiveRecord::Base.connection.delete("DELETE FROM sessions WHERE updated_at < now() - INTERVAL 1 HOUR")'


3) My launchd task plist file (yours will vary):

<?xml version="1.0" encoding="UTF-8"?>
DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Labelkey>
        us.boygeni.mysql-session-sweeper</string>
        <key>LowPriorityIOkey>
        />
        <key>ProgramArgumentskey>
        
                /users/defeated/Sites/rails_apps/boygenius/script/runnerstring>
                'ActiveRecord::Base.connection.delete("DELETE FROM sessions WHERE updated_at < now() - INTERVAL 1 HOUR")'</string>
        array>
        RunAtLoad</key>
        <true/>
        <key>StartIntervalkey>
        3600</integer>
dict>
</plist>

Lighttpd launchd item for OS X 10.4

Save the following in /Library/LaunchDaemons/net.lighttpd.plist to have lighttpd start automatically on any OS X 10.4 computer. Note that this assumes a working DarwinPorts lighttpd installation (otherwise you will need to change the paths to the lighttpd executable). Note that this also assumes that the lighttpd.conf file is in /opt/local/etc.

<?xml version="1.0" encoding="UTF-8"?>
DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Labelkey>
        net.lighttpd</string>
        <key>OnDemandkey>
        />
        <key>Programkey>
        /opt/local/sbin/lighttpdstring>
        ProgramArguments</key>
        <array>
                <string>/opt/local/sbin/lighttpdstring>
                -f/opt/local/etc/lighttpd.confstring>
                -D</string>
        array>
</dict>
plist>

MySQL launchd item for Mac OS X Tiger

(Originally posted at Unquiet)

I had to reinstall Mysql because it wasn�t one of the things I backed up before erasing my hard drive. Since I�m now running Mac OS X 10.4 �Tiger�, I decided to set it up to start when the system boots, but the system for creating startup items has changed slightly. So I saved the following xml in /Library/LaunchDaemons/com.mysql.Mysql.plist:

<?xml version="1.0" encoding="UTF-8"?>
    DOCTYPE plist PUBLIC 
         "-//Apple Computer//DTD PLIST 1.0//EN" "
        http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Labelkey>
        com.mysql.Mysql</string>
        <key>OnDemandkey>
        />
        <key>ProgramArgumentskey>
        
                /usr/local/mysql/bin/mysqld_safestring>
        </array>
        <key>ServiceDescriptionkey>
        Mysql 4.1 Database Server</string>
        <key>UserNamekey>
        mysql</string>
        <key>WorkingDirectorykey>
        /usr/local/mysqlstring>
    </dict>
    plist>


Note that I'm using the official OSX distribution of MySQL... but with a few changes to match your database location, you can get this to work with other installs (fink, darwinports, etc).
« Newer Snippets
Older Snippets »
4 total  XML / RSS feed