Migrating from cron to Launchd


So I took the plunge.  My old Dell PC is sitting next to the window and has not been powered on for over a month.  I made the switch.  I bought a MacBook Pro earlier last year after doing some work at Apple, and immediately fell in love with OS X.  I’m a Unix guy at heart, and have always craved that type of operating system.  Even before I was a Unix guy, I was a Mac guy.  Shout out to the old Macintosh Classic and your beautiful OS that fit on a 3.5″ floppy.

I started to really get into the tools of OS X, and then decided it was Chris’s turn.  So she turned in her old red Dell, and got herself a MacBook with a pink cover on it.  If you know Chris, you know how much she LOVES change.  She eventually gave in, and really has started to like it (I think anyway…).

In my migration, I combined 2 Dell machines functionality into this one Mac Pro.  My desktop and main beefy server at the house are now combined into one.

In the process, I needed to migrate some automated tasks from the Debian server onto the Mac Pro.  In Leopard, cron and StartupItems have been deprecated in favor of LaunchD.  So I had to learn a whole new way to deal with scheduling tasks.

Mind you, this is absolutely new to me, and still fairly  new in the community.  There are not a ton of examples out there.

So my problem was (apparently) that some of the default behavior of the launchd scripts was causing my little backup runs to be constantly loaded and called.  Was taking about 2.5Mbps of my download bandwidth steady because it would run over and over, sometimes 3 and 4 times per minute.

My lesson?  Watch the exit status of the scripts.  And be sure to set KeepAlive to false (that’s the default property, but I’m not feeling a whole lot of confidence in that).

Slowly but surely, I will own you Launchd….


One response to “Migrating from cron to Launchd”

  1. I fell in love with Macs at my old job @ UTSouthwestern, the analytical software we were using was only compatible with Mac OS. I do miss them, and even though I did not enjoy the switch back to PCs, I am just flat out timid to make the switch back. Plus, I have no clue if the software I must use now would work. Good for you, n3rd.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.