Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

#! /bin/sh

while [ true ]; do

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.

share|improve this question

migrated from Jun 10 '13 at 14:51

This question came from our site for professional and enthusiast programmers.

/etc/init.d is not the proper place for that script. See -- a script that automatically restarts firefox seems like it belongs in your personal bin. – cmt Jun 10 '13 at 11:52

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

while true; do
share|improve this answer
it doesn't work anyway. If I close firefox it doesn't open again. I'm using Ubuntu 10.04 – Amk Jun 10 '13 at 10:21
Do you have any other windows of Firefox open? What happens if you add echo Restarting as the next line after firefox? – Koterpillar Jun 10 '13 at 10:26
No. When I turn on the pc nothing is open, just the Firefox window. And I added the echo restarting line, but nothing happens. – Amk Jun 10 '13 at 10:34
Can't reproduce it here. What's your environment (OS, Firefox version)? – Koterpillar Jun 10 '13 at 10:37
What happens when you run firefox from a command prompt and then close its window? Do you see a prompt again? – Koterpillar Jun 10 '13 at 10:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.