Mailinglist Archive: opensuse (769 mails)

< Previous Next >
Re: [opensuse] start firefox from script
On 2016-05-16 21:01, Istvan Gabor wrote:

I would like to start firefox browser from bash script. I made this script:

#! /bin/bash

ffpid=`pidof firefox`

echo "firefox PID is: $ffpid"

if test $ffexit == 0
then `kill -9 $ffpid`

sleep 5

firefox -P list &


What I want is to check if firefox is running, if it's runing stop it and
start it again with specific profile with specific URL.
This works with the above script but the problem is if I run the script at
least two times, the second time firefox opens with two tabs,
with the same content in both tabs. How can I force it to open only on tab
with the URL in the command line specified?
In firefox preferences I've set General/Startup: When firefox start: Show a
blank page. I use an old firefox version (24.8.1 ESR,
the last ESR that doesn't have australis uinterface), I don't know if it


You have to verify that the second time it really obtains the PID of the
running firefox. Then you have to verify that it is killed, and wait
till it does die (not five seconds), and if it doesn't, abort with message.

Suggest kill, then loop till PID is not found. Also suggest do not use
kill 9, but a normal kill.

Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 "Bottle" at Telcontar)

< Previous Next >
Follow Ups