I have an app which I want to run as a service on windows and mac, however I have this problem.
if I make the app a serviceappcation it works fine as a service under windows but as a service on a mac it just runs loads of times even using a mutex
if I make the app a console app, it works fine on a mac, but then under windows i have no ability to stop and start the service
Is there a way in compile directives that I can automate what the app will be, either service or console? taking into account if I change the type to console from service I have to keep removing the stop method of app.
I’m curious. In the other thread, you mentioned that the app was crashing on startup. Is that still happening?
You might also want to check and see if the app is actually creating the mutex file. I suspect it’s not and that would explain why you’re getting multiple instances.
Also, where are you putting the daemon plist file? And can you show what the plist looks like?
Also, if you’ll be doing a lot of daemon work, I suggest using LaunchControl. It’s well worth the $10 and makes setting up, experimenting with and maintaining Agents and Daemons a breeze on macOS.
In LaunchControl, check out the StandardOutput key. That’ll allow you to send the results of Print and StdOut to a specific file for debugging instead of having to weed through the system logs.