OS X Daemon Programs

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
SirWobbyTheFirst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 246
Joined: Tue Jun 30, 2009 11:15 pm

OS X Daemon Programs

Post by SirWobbyTheFirst » Thu Apr 01, 2010 5:35 pm

Hello Everyone.

I have finally made the jump to Mac OS X the other day and I'm now the proud owner of an iMac running Snow Leopard. I started working on porting my applications to OS X and wondered how I would create a OS X like service (Or daemon to be precise) because Revolution is a GUI based app and the daemons for OS X or started before the GUI starts and so I was wondering how I would be able to do it with the GUI inactive or the user booted into Single User Mode.

I read in the Read Me file about a special Darwin engine which would enable me to compile rev based console applications, would this do the trick? It seems pretty old as the Read Me stated it was version 2.1.2.

Any help would be most appreciated cos I'm completely clueless having no experience with OS X at all.

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: OS X Daemon Programs

Post by BvG » Thu Apr 01, 2010 5:46 pm

To use the command line version of rev, you need a version before 4.0. If you have bought 4.0 you can ask support so that they give you 3.5.

A command line script is used the same way as a cgi, and almost all the relevant caveats apply.

You say you're clueless about os x. So be assured that starting a deamon in os x is _not_ appreciated by either mac users not the system itself. If the goal is simply a faceless app that starts on startup, look at the "account" system settings for "Login items", set your app there and check the "hide" mark.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

SirWobbyTheFirst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 246
Joined: Tue Jun 30, 2009 11:15 pm

Re: OS X Daemon Programs

Post by SirWobbyTheFirst » Thu Apr 01, 2010 5:48 pm

Hmm. So would this have the same effect as a Windows Service and it won't be terminated at logoff? If so then would I be able to keep by current version of 4.0?

Thanks for the quick response as well BvG :)

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: OS X Daemon Programs

Post by BvG » Thu Apr 01, 2010 6:11 pm

No, in windows a "login item" would be more like something in the "startup" folder in the windows menu. So a logout will quit all those apps.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

SirWobbyTheFirst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 246
Joined: Tue Jun 30, 2009 11:15 pm

Re: OS X Daemon Programs

Post by SirWobbyTheFirst » Thu Apr 01, 2010 6:13 pm

Oh right. Bummer. :-/

Oh well thanks anyway BvG I appreciate the help. :)

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10053
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: OS X Daemon Programs

Post by FourthWorld » Thu Apr 01, 2010 6:38 pm

Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

SirWobbyTheFirst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 246
Joined: Tue Jun 30, 2009 11:15 pm

Re: OS X Daemon Programs

Post by SirWobbyTheFirst » Thu Apr 01, 2010 7:02 pm

Thanks alot FourthWorld. I've bookmarked the page and will take a look at it later.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: OS X Daemon Programs

Post by mwieder » Fri Apr 02, 2010 1:05 am

It's somewhat true that you need the 3.5 engine. I've made faceless standalone apps for all three supported platforms (Windows, OSX, linux) that take commandline arguments, do their thing, and exit. You don't need to be running in a cgi mode for this, you just need to process the commandline arguments at startup. If you want to process revTalk script files then you do need the cgi mode, and at the moment you need the 3.5 engine for that.

I've also written a login-level app for OSX that installs itself once, asking for sudo password access, then just runs on startup each time (it installs a desktop background from the Astronomy Site of the Day website). It's a login app, not a daemon - I haven't had the need to try making a daemon yet, but from a technical level I don't see why it couldn't be done.

Post Reply