User Tools

Site Tools


diverses:mozilla

Eine kleine Sammlung hilfreicher Tricks für Mozilla's Firefox, Thunderbird aber auch deren Derivate wie Iceweasel oder Icedove. Darf gerne erweitert werden ;)

Programm lässt sich nicht starten, da es angeblich läuft

Mozilla setzt Lock-Dateien um ein mehrfaches Starten des selben Accounts zu verindern. Manchmal bleiben diese Dateien bestehen. Ein einfaches Löschen schafft Abhilfe.

delmoz.sh

#!/bin/bash

# Simple script to delete lock files of Firefox,Iceweasel,Thunderbird or Icedove
# Syntax: delmoz.sh [firefox|iceweasel|thunderbird|icedove]"
#         Argument is optional"
#
# Licence: "Public Domain" or "CC BY" or "Simplified BSD"
# 2015, Martin Johannes Dauser


#define lock files for Firefox/Iceweasel
FIRE_LOCK="~/.mozilla/firefox/*.default/lock"
FIRE_PARENT=" ~/.mozilla/firefox/*.default/.parentlock"

#define lock files for Thunderbird
THUN_LOCK="~/.thunderbird/*.default/lock"
THUN_PARENT="~/.thunderbird/*.default/.parentlock"

#define lock files for Icedove
DOVE_LOCK="~/.icedove/*.default/lock"
DOVE_PARENT="~/.icedove/*.default/.parentlock"


##SyntaxCheck#####################################


if [ $# -eq 0 ]; then
  echo "[W] Will attempt to delete all lock files from: "
  echo "      + firefox / iceweasel"
  echo "      + thunderbird / icedove"
  echo "    hit enter to proceed or [n]o | [n]ein to abort "
  echo "    alternatively enter the desired program"
 read CHOICE
 case "$CHOICE" in
   n|no|N|No|NO) echo "Aborting"; exit 0
   ;;
   firefox|Firefox|iceweasel|Iceweasel|thunderbird|Thunderbird) set -- "$CHOICE"
   ;;
   "") echo "Proceeding..."
   ;;
   *) echo "[ERROR] Bogus input, aborting"; exit 0
   ;;
 esac
fi

if [ $# -gt 1 ]; then
  echo "[ERROR] Syntax delmoz.sh [firefox|iceweasel|thunderbird|icedove]"
  echo "        Argument in [] is optional"
  exit 1
fi


##Firefox#Iceweasel##################################


if [ $# -eq 0 -o "$1" = "firefox" -o "$1" = "iceweasel" ]; then

  if [ -n "$(pgrep firefox)" -o -n "$(pgrep iceweasel)" ]; then
    echo "[ERROR] Firefox or Iceweasel is running, please stop it first"
    exit 1
  fi

  echo "searching for locks from Firefox/Iceweasel ..."
  if [ -e $FIRE_LOCK ]; then
    echo "[i]found $FIRE_LOCK trying to delete file"
    rm -f $FIRE_LOCK
    if [ ! -e $FIRE_LOCK ]; then
     echo "[i] $FIRE_LOCK successfully deleted"
    else
     echo "[ERROR] can not delete $FIRE_LOCK - aborting"
     exit 1
    fi
  else
    echo "[i] $FIRE_LOCK does not exist"
  fi

  if [ -e $FIRE_PARENT ]; then
    echo "[i] found $FIRE_PARENT trying to delete file"
    rm -f $FIRE_PARENT 
    if [ ! -e $FIRE_PARENT ]; then
     echo "[i] $FIRE_PARENT successfully deleted"
    else
     echo "[ERROR] can not delete $FIRE_PARENT - aborting"
     exit 1
    fi
  else
    echo "[i] $FIRE_PARENT does not exist"
  fi
  echo "[i] Firefox/Iceweasel should work"

  if [ "$1" = "firefox" -o "$1" = "iceweasel" ]; then
    echo "$1"
    echo "exit 0"
  fi
fi


##Thunderbird#####################################


if [ $# -eq 0 -o "$1" = "thunderbird" ]; then

  if [ -n "$(pgrep thunderbird)" ]; then
    echo "[ERROR] Thunderbird is running, please stop it first"
    exit 1
  fi

  echo "searching for locks from Thunderbird ..."
  if [ -e $THUN_LOCK ]; then
    echo "[i]found $THUN_LOCK trying to delete file"
    rm -f $THUN_LOCK 
    if [! -e $THUN_LOCK ]; then
     echo "[i] $THUN_LOCK successfully deleted"
    else
     echo "[ERROR] can not delete $THUN_LOCK - aborting"
     exit 1
    fi
  else
    echo "[i] $THUN_LOCK does not exist"
  fi

  if [ -e $THUN_PARENT ]; then
    echo "[i] found $THUN_PARENT trying to delete file"
    rm -f $THUN_PARENT 
    if [ ! -e $THUN_PARENT ]; then
     echo "[i] $THUN_PARENT successfully deleted"
    else
     echo "[ERROR] can not delete $THUN_PARENT - aborting"
     exit 1
    fi
  else
    echo "[i] $THUN_PARENT does not exist"
  fi
  echo "[i] Thunderbird should work"

  if [ "$1" = "thunderbird" ]; then
    exit 0
  fi
fi


##Icedove#########################################


if [ $# -eq 0 -o "$1" = "icedove" ]; then

  if [ -n "$(pgrep icedove)" ]; then
    echo "[ERROR] Icedove is running, please stop it first"
    exit 1
  fi

  echo "searching for locks from Icedove ..."
  if [ -e $DOVE_LOCK ]; then
    echo "[i]found $DOVE_LOCK trying to delete file"
    rm -f $DOVE_LOCK 
    if [ ! -e $DOVE_LOCK ]; then
     echo "[i] $DOVE_LOCK successfully deleted"
    else
     echo "[ERROR] can not delete $DOVE_LOCK - aborting"
     exit 1
    fi
  else
    echo "[i] $DOVE_LOCK does not exist"
  fi

  if [ -f $DOVE_PARENT ]; then
    echo "[i] found $DOVE_PARENT trying to delete file"
    rm -f $DOVE_PARENT 
    if [ ! -e $DOVE_PARENT ]; then
     echo "[i] $DOVE_PARENT successfully deleted"
    else
     echo "[ERROR] can not delete $DOVE_PARENT - aborting"
     exit 1
    fi
  else
    echo "[i] $DOVE_PARENT does not exist"
  fi
  echo "[i] Icedove should work"

  if [ "$1" = "icedove" ]; then
    exit 0
  fi
fi


##FinalCheck#####################################

if [ $# -eq 0 ]; then
  exit 0
fi

# If nothing worked out till now, there must be some error in syntax.

echo "[ERROR] Syntax delmoz.sh [firefox|iceweasel|thunderbird|icedove]"
echo "        Argument in [] is optional"
exit 1
diverses/mozilla.txt · Last modified: 2015/03/16 18:39 by mdauser