I am making an app using pygtk, glade, and quickly and want to make a daemon that runs in the background to provide unity notifications for alarms and events. I would like to find a way to not require root authentication after installing the *deb file. I have tried adding a script to the users crontab but it seems that would require the restart of crond. (which needs either root or a reboot) I was wondering if there was a project I should look at to see an example of a daemon in python or how I could go about this? Thank you in advance for any help and feel free to tell me I'm wrong!
1 Answer
Daemons are usually run by root (although they sometimes change the user under they run).
For a normal notification you don't need to create a daemon, just create a normal program and let it run at the start of a session. This way it will run with user privileges, and you will run a separate instance for each user.
I have done this program, it's a bit more complex than what you need, as it uses different libraries to run in different systems but it is quite simple and maybe a good example.
-
I want to clarify, you are using
gobject.timeout_add(interval, callback, ...)
to check the alarm at a regular interval, aren't you? Does this function do checking in the main loop (busy waiting rather than idle)?– fikr4nNov 22, 2013 at 0:21 -
Yes, the gtk version is using gobject.timeout. I don't understand what you mean with checking in the main loop, but anyway it doesn't do any kind of busy waiting. Nov 22, 2013 at 14:50