![]() |
Shell Script : Kill a running process when another process starts
Hi , I was wondering if i could kill an already running process when i start another one.
For example , If i run firefox , i want that totem be killed before firefox starts( Because if totem is running , firefox doesnt play any sound ). How can this be achieved ? I hope Im clear with my query. Thanks. |
As a quick fix, you could change however you start firefox to something like this:
Code:
pkill totem && firefox |
Thanks for the info , but i cant figure out how to add this to firefox startup , Im using Ubuntu Hardy and running Firefox from
Applications > Internet > Firefox . Any ideas ? |
The Firefox icon you are using has a setting entry in its right-click menu. There, you can replace the current command with what gilead said.
However, 'pkill totem' will return a failed exit code if totem isn't running. The && operator will then fail to start Firefox because it will only execute the command if the previous command returned no error. Replace the && with a ; instead. This way the two commands will simply be executed in sequence, regardless of whether pkill finds a totem to kill or not. Robin |
| All times are GMT -5. The time now is 12:23 AM. |