Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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! :)

share|improve this answer
    
Thanks for the info. So would the script automatically run on boot? Does it need to be stored somewhere in particular? –  Jon Hudson Apr 7 '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 9 '13 at 3:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.