Question

I'm new in Mac OS X world but I have skills on Windows dev.

I need to develop a daemon (on Windows will be Windows Service) that uploads/downloads files from a Web Service.

My question is: is it possible to create an app written in Objective-C that will be the daemon (to upload/download) and to launch it when the OS starts using launchd? Or there's another way to create a daemon?

Thank you

Was it helpful?

Solution

I don't know if I have understood correctly but I guess you can do it. The next link could be a good start for understand how Daemons work in Objective-C Apple Developer Then here there is a interesting piece of code. It is about GPS but it might be usefull. Also get a look of this github folder.It is a controller for start/stop daemons

OTHER TIPS

On OS X these services are called LaunchDaemon (system-wide) and LaunchAgent (user-specific). You create a configuration which tells the system when to start, which executable to run, what to do with stdin, stdout, and stderr, which arguments to pass, and so on. Have a look at these man pages:

launchd(8)       # the service controlling other services
launchctl(1)     # the command to control services
launchd.plist(5) # the configuration format for services

The daemon can be written in any language that runs on OS X. So Objective-C is a typical choice for the Mac platform, but anything else from Ruby, Python, and Perl over AppleScript to plain C or C++ would do.

And no, there is no other (recommended) way to do this on the Mac. init.d-style scripts don't work on the Mac [or on Darwin, it's UNIX layer]. Or, more precisely, there is not the infrastructure that runs them.

For more info see the Daemons and Services Programming Guide.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top