4

Possible Duplicate:
Automatically close application after custom time?

I want to stop/kill my totem player after a specific amount of time. Can it be done?

harisibrahimkv
  • 7,256
  • 11
  • 44
  • 71

2 Answers2

4

It can be done with a simple command. Once Totem is running, open up the terminal and enter the following line:

$ sleep n && totem --quit

Where n is the number of seconds you want to have elapsed before Totem is closed.

Explanation of the command

This is a very simple command, and if you want to learn more about using the terminal you should consider reading a bash tutorial, like this one.

The sleep n command waits until n seconds have elapsed and then the next command can be run.

Writing && after it tells the terminal to run another command as soon as the previous is finished, which is why I have written totem --quit after it.

You can do many more actions and not just quitting. Many applications in linux have a command line interface, which allow you to do this. To see what actions you can do on them through their interface, it is a good idea to check its manual, by running in a terminal $ man <application>; or help text, which is usually shown by running in a terminal $ <application> --help.

Severo Raz
  • 5,971
  • Totem was just an example. If I replace totem with the application name, will that work? – harisibrahimkv May 03 '12 at 16:41
  • I have updated the answer to explain this, but yes - as I wrote - any command after the && will do. If the application didn't have a command line interface, you could write killall <application> instead of totem --quit. – Severo Raz May 03 '12 at 16:50
3

I've found an alternative answer with another command.

Step 1. Find the process id.

haris@asylum:~$ ps -e | grep totem
7315 ?        00:00:30 totem

Step 2. Give the time at which to kill it.

haris@asylum:~$ at 11.30pm
warning: commands will be executed using /bin/sh
at> kill 7315
at> <EOT>
job 8 at Sun Oct  2 07:30:00 2011

Where EOT refers to Control+d.

Severo Raz
  • 5,971
harisibrahimkv
  • 7,256
  • 11
  • 44
  • 71