How can I automatically restart chromium if it crashes?

人走茶凉 提交于 2019-12-10 20:46:49

问题


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.



来源:https://stackoverflow.com/questions/17938511/how-can-i-automatically-restart-chromium-if-it-crashes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!