How can I automatically restart chromium if it cra

2019-07-04 19:54发布

问题:

I'm using chromium-browser in kiosk mode as a display, but from time to time it might crash. I'd like to be able to kill / re-start the browser if that happens, but I'm unable to check chrome's status.

Does anyone know how to check if chromium has crashed, or configure chrome to shutdown if it crashes?

Chromium 28.0.1500.52 Ubuntu 12.04

回答1:

Put the following code in a file, name it whatever you like (foo):

#!/bin/sh
while :        # run forever
do
   chromium-browser
done

Then execute:

chmod +x foo

to make the file named foo executable.

When your kiosk starts, invoke the program foo (the file you just created).

The script runs the chrome browser in a "do this forever" loop. If the browser ever dies (for whatever reason), the script will restart it.