Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to automatically close a certain application after custom time?

Update: i.e. stop the Audioplayer after a certain time.

share|improve this question
Could you give a use case example? – Marco Ceppi Jan 3 '11 at 0:00
sure, updated the question. – NES Jan 3 '11 at 14:53
up vote 9 down vote accepted

Install gnome-schedule from the Ubuntu Software Center, load the program from Applications > System Tools. Use it to add an entry for the time you want the program to be closed like so:

alt text

This will kill all instances of firefox at a certain date/time, you can also have reoccurring events that kill off certain programs at certain times, for instance to encourage kids to not browse the internet or for killing certain games.

It is possible to do this kind of thing from the commandline too, but you need to know how to use crontab -l and how to write cron lines.

share|improve this answer
A similar technique would just involve the commandline. E.g., sleep 3600 && killall -9 firefox-bin would wait 3600 seconds (1 hour), and then kill all instances of Firefox. – frabjous Jan 3 '11 at 1:06

Perhaps you could alias the applicaton, or change its start up, so it fires off an 'at' command as it starts. 'at' can be used to schedule one off jobs to occur later on. 'man at' should give you the info.

So the next bit would be to start your process (without waiting for it to stop), grab the id, then pass that into at. $! should hold that, and ampersand will make it not wait. $* to pass through the original parameters will help too.

Try something like:

<your process> $* & export PID=$!
echo kill $PID | at now +1 hour
share|improve this answer

Your Answer


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.