Mailinglist Archive: opensuse (769 mails)

< Previous Next >
Re: [opensuse] start firefox from script
On 05/17/2016 02:28 AM, Istvan Gabor wrote:
I start firefox:

firefox

Then I stop it using kill:

ps -e|grep firefox
13404 pts/8 00:00:00 firefox

kill 13404

Then I start it again:

firefox

Hey guys,

please don't do racy ps(1) output voodoo.

Firefox with that profile should only be running once, right?
Why don't you do it easier and just save the PID and kill exactly
that instance?

-------------------
#!/bin/bash

FFPIDFILE="$HOME/.ffpid"
FFPROFILE='list'

test -r "$FFPIDFILE" \
&& . "$FFPIDFILE"

test "$FFPID" \
&& kill "$FFPID" 2>/dev/null \
&& wait "$FFPID"

firefox -P "$FFPROFILE" --new-window "$@" &
echo "FFPID=$!" > "$FFPIDFILE"
-------------------

Just call it with the URL as parameter.

Have a nice day,
Berny
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups
References