In Mandrake 6.0, the /usr/bin/netscape script just runs the appropriate
netscape executable, even if it's already running. This causes an error
message about the ~/.netscape/lock file and if you continue you "will be
unable to use the disk cache, global history, or your personal
certificates."
I found a facility in Netscape that lets you control the running
process. I modified the /usr/bin/netscape script to make use of this and
attached it below. If Netscape is running, it will command it
appropriately. If it is not, it will act as before.
I would be quite surprised if I was the first to think of this. I
suspect that this functionality has been considered and forgone for some
reason. If that's the case, I'd like to hear about it. If people do
find this script useful, let me know and I will improve it.
#!/bin/sh
## /usr/bin/netscape
## modified to command the currently running Netcape if there is one
## 990727 Turadg Aleahmad <[EMAIL PROTECTED]>
## origin Mandrake 6.0
which=""
PREFIX=$(dirname $(dirname $0))
if echo $0 | grep 'navigator' >/dev/null; then
which=netscape-navigator
elif echo $0 | grep 'communicator' >/dev/null ; then
which=netscape-communicator
elif [ -x $PREFIX/lib/netscape/netscape-communicator ]; then
which=netscape-communicator
elif [ -x $PREFIX/lib/netscape/netscape-navigator ]; then
which=netscape-navigator
else
echo "You don't seem to have netscape installed."
exit 1
fi
# If Netscape is already running, don't try invoking a new one
# 990727 Turadg Aleahmad <[EMAIL PROTECTED]>
# Reference: http://home.netscape.com/newsref/std/x-remote.html
if [ -L ~/.netscape/lock ]; then
# If the command name contained 'mail'
if (echo $0 | grep 'mail' >/dev/null) ||
# or the command was for Communicator but had mail as its argument
[[ $which == netscape-communicator ]] && [[ $1 == '-mail' ]]; then
# Open the Netscape Mail Inbox
exec $PREFIX/lib/netscape/$which -noraise -remote 'openInbox()'
elif [ -z "$*" ]; then
# Open a new web browser
exec $PREFIX/lib/netscape/$which -noraise -remote 'openBrowser()'
else
# Open the argument as a URL
exec $PREFIX/lib/netscape/$which -noraise -remote "openURL($1,
newwindow)"
fi
exit 0
fi
if [ -z "$*" ]; then
HOMEPAGE=/usr/doc/HTML/index.html
if [ -f $HOME/.netscape/preferences.js ]; then
if grep "browser.startup.homepage" \
$HOME/.netscape/preferences.js > /dev/null; then
HOMEPAGE=""
fi
fi
exec $PREFIX/lib/netscape/$which $HOMEPAGE
else
exec $PREFIX/lib/netscape/$which $*
fi
echo "An error occurred running and $PREFIX/lib/netscape/$which."