1

I have VM Ubuntu 14.0 and make new VM with Lubuntu so i can use less RAM. But my shell script (the same from Ubuntu) won't close the firefox. I try all commands for killing a proccess (kill,killall...other i don't remember now)

Please can you tell me what is the problem Here is the code.

#!/bin/bash
export DISPLAY=:0

/home/lubi/Desktop/firefox/firefox
sleep 200
killall firefox  # This line doesn't work
  • 1
    What happens if you try it from the command line? What if you try sudo killall firefox? – WinEunuuchs2Unix Sep 3 '18 at 15:22
  • 2
    Always the cure is simple but need to find it :) "&" on the end of the line do the work. I delete the previous version of firefox and unpacked my version. Thank you now is ok . – Aleksandar Gjorgjievski Sep 3 '18 at 15:30
  • I've moved my comment to an answer. Please accept it to mark the question as answered. By the way: welcome to AskUbuntu! – 0x2b3bfa0 Sep 3 '18 at 15:44
2

The issue is that when you spawn a Firefox instance for the first time, it will block the execution of the script until you manually close all the instances or kill the process. This behavior is keeping your script from going past the line which runs firefox.

The odd part of the problem is (probably) that on Ubuntu you were running the script after manually opening Firefox from the GUI, but on Lubuntu you didn't have any running Firefox instance.

To solve this issue, you may run the firefox process in the background, letting the script continue even if the proccess won't exit inmediately. To do this, you only need to append an ampersand to your command like so:

/home/lubi/Desktop/firefox/firefox &

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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