shell - Automatic autorestart Firefox on close

07
2014-07
  • Questioner

    I want firefox to restart automatically when I close it. I found this script

    #! /bin/sh
    
    while [ true ]; do
            firefox
    done
    

    and I put a file with that script in the /etc/init.d folder. Firefox starts, but when I close it, it doesn't open again.

  • Answers
  • Koterpillar

    You shouldn't use the test operator ([) around true:

    #!/bin/sh
    while true; do
        firefox
    done
    

  • Related Question

    browser addons - How to automatically save sessions with multiple windows in Firefox
  • Matthew Talbert

    I've used primarily Firefox's built-in session management until recently. Now my needs have become more sophisticated. What I want is to be able to have two windows, one with a fixed set of tabs (approximately five) and the other with "automatic save".

    That is, when I start Firefox, I want one window to open with my five tabs, and another to open with whatever I had when I shut down Firefox. I've installed "Session Manager", but I can't seem to get it to do what I want. It will save one window, but when I close one window, it removes that one from the session.

    How do I do this with either Session Manager or another plugin?


  • Related Answers
  • alfplayer

    Just make sure "Tools > Options > Main > Startup > When Firefox starts > show my windows and tabs from last time" is selected and that you close Firefox from "File > Exit" so you close all windows. If you close Firefox windows separetely Firefox will only bring back the last closed window.

    This was my set-up, but now I just use one window, together with the FaviconizeTab addon to strip the titles from all tabs, and leave the permanent tabs at the lefmost postions. This way, I don't have to switch between Firefox windows.

  • Snark

    It should work with the Tab Mix Plus add-on. It comes with its own session manager.

    Tab Mix Plus (TMP) is a very popular extension for the Mozilla Firefox browser that enhances Firefox's tab browsing capabilities. It includes such features as duplicating tabs, controlling tab focus, tab clicking options, undo closed tabs and windows, plus much more. It also includes a full-featured Session Manager with crash recovery that can save and restore combinations of opened tabs and windows.

    I think that, in the windows with the predefined set of tabs, you'd have to use the command "Protect tab" (or "Freeze" or "Lock", by right-click on the tab) for the tab you want to keep.

    Protected tab: A tab that is prevented from closing. You can load other sites in the tab and browse to other URLs in the tab. Notice that the close button is missing from the right side of the tab, so you cannot close the tab. If you try to close Firefox, you will get a warning message about closing the protected tab.

    Locked tab: A tab that is prevented from navigating to another page or URL. Your tab is locked on the current page or URL. Nothing new can load in the tab, but you can refresh the same page. All links will open in a new tab (link, history, bookmark, etc.). Notice that the close button is available, so you can close a locked tab.

    Frozen tab: A tab that is both locked and protected. It will not close and nothing new can be loaded in it. You will not be able to navigate away from the current page. All links will open in a new tab (link, history, bookmark, etc.) Notice that the close button is missing from the right side of the tab, so you cannot close the tab. If you try to close Firefox, you will get a warning message about closing the protected tab.

  • Heptite

    There is an add-on here that you can use:

    https://addons.mozilla.org/en-US/firefox/addon/save-my-tabs/

    You can quickly recover the tabs which are automatically saved as a .txt file.

    You can then use for example http://linkopener.com to open them all

  • Nathaniel

    Perhaps a session manager add-on + PermaTabs would get you there. Only thing might be that it would open the permanent tabs plus your last session in the same window -- I don't know, you'd have to check it out.

  • Peter Mortensen

    If you set "Tools > Options > Main > Startup > When Firefox starts > Show my windows and tabs from last time". There is also an add-on that adds a toolbar button to "Exit Firefox" to close and save all windows.