On 2016-05-16 21:01, Istvan Gabor wrote:
Hello:
I would like to start firefox browser from bash script. I made this script:
#! /bin/bash
ffpid=`pidof firefox` ffexit=$?
echo "firefox PID is: $ffpid"
if test $ffexit == 0 then `kill -9 $ffpid` fi
sleep 5
firefox -P list http://lists.opensuse.org/opensuse/2016-05/all.html &
exit
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 matters.
Guessing. 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)