2

I'm developing my first application for Ubuntu, and part of the apps functionality will involve displaying notifications based on dates that are in a SQLite database. How can I get the app to automatically perform a task every day at certain times, without the user having to run the app. So basically I would need the app to always run in the background, I think?

(I'm using python and GTK+3)

Thank you!

1 Answers1

2

This question is more apt for stackoverflow, but valid none-the-less. You're looking for what is known as a daemon in the *nix world. A daemon is a background service that is usually started automatically on boot, but can be invoked at any time.

I haven't had much experience with python-based daemons (only C), but the concepts are similar. See this daemon-skeleton code from the Python Cookbook. All you have to do is override the run() method in the derived MyDaemon class.

If having an extra class for the sole purpose of daemon-izing is overkill (I can't see how, but anyway), try this (found at stackoverflow) :)

Hope this helps! :)

amrith92
  • 444
  • Thanks for the info. So would the script automatically run on boot? Does it need to be stored somewhere in particular? – Jon Hudson Apr 07 '13 at 17:09
  • yes, the script should run automatically. Generally, boot-up scripts need to be stored in the /etc/init.d directory – amrith92 Apr 09 '13 at 03:33