[Qt-interest] QtService startup on Mac
Daniel Grubbs
dgrubbs at dexrex.com
Fri Jul 31 19:04:26 CEST 2009
I've got a Daemon derived from QtService:
class Daemon : public QtService<QCoreApplication>
{
public:
Daemon(int argc, char **argv);
~Daemon();
protected:
void start();
void stop();
};
I want this to run as root on system startup and have gotten it to work well
on both Windows and Linux. There's a problem on the Mac though.
I have a property list file, which I have placed in /Library/LaunchDaemons:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "
http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.dexrex.launchdaemon</string>
<key>Program</key>
<string>/-Path to executable-/Daemon</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>OnDemand</key>
<true/>
</dict>
</plist>
This is launched by launchd and partially works. It starts the daemon fine,
but doesn't work to keep it alive. If I take out the
"<key>OnDemand</key><true/>", which shouldn't be needed, launchd starts the
daemon twice and then repeatedly tries to start it again every 10 seconds.
It doesn't seem to recognize that it is already running twice. Adding the
OnDemand key prevents it from trying to restart repeatedly (It only starts
once, and works fine.) but is no longer restarted if it dies.
Any suggestions would be appreciated.
Thanks,
Dan Grubbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090731/032fae59/attachment.html
More information about the Qt-interest-old
mailing list