You are not logged in.

#1 2016-01-02 00:01:40

bordot
Member
Registered: 2016-01-01
Posts: 3

Possible to create a script to restart Chromium?

Hello,

I was hoping someone might be able to help me. I'm looking for a script that will restart Chromium and restart it to a certain website every hour. Any help would be appreciated!

Thanks

Offline

#2 2016-01-02 00:06:18

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,719

Re: Possible to create a script to restart Chromium?

It might be easier to do it inside chromium with a simple easy to write extension. 
Or what about one from the play store? https://chrome.google.com/webstore/deta … cebd?hl=en

Last edited by ewaller (2016-01-02 00:06:34)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#3 2016-01-02 00:07:42

ayekat
Member
Registered: 2011-01-17
Posts: 1,634

Re: Possible to create a script to restart Chromium?

Welcome to the Arch Linux forums!

bordot wrote:

restart it to a certain website every hour

What do you mean with "a certain website"? Always the same? Or changing depending on the time/location/Saturn's position in the sky?
What is your real goal?

EDIT
As a quick hack:

while true; do
    chromium "$url" &
    chromium_pid=$!
    sleep 3600
    kill $chromium_pid
done

How you set $url would then be up to you.

EDIT2
Or as ewaller suggested.

Last edited by ayekat (2016-01-02 00:10:09)


pkgs │ hacks │ cfg │ blag

Offline

#4 2016-01-02 00:16:18

bordot
Member
Registered: 2016-01-01
Posts: 3

Re: Possible to create a script to restart Chromium?

ayekat wrote:

Welcome to the Arch Linux forums!

bordot wrote:

restart it to a certain website every hour

What do you mean with "a certain website"? Always the same? Or changing depending on the time/location/Saturn's position in the sky?
What is your real goal?

EDIT
As a quick hack:

while true; do
    chromium "$url" &
    chromium_pid=$!
    sleep 3600
    kill $chromium_pid
done

How you set $url would then be up to you.

EDIT2
Or as ewaller suggested.

For example, I want the script to kill the entire Chromium browser every 1hour and restart it at google.com. Would that quick script do that?

Thank both of you for your help.

Offline

#5 2016-01-02 00:18:54

ayekat
Member
Registered: 2011-01-17
Posts: 1,634

Re: Possible to create a script to restart Chromium?

Yes, if you set "http://google.com/" as the $url, it should do that. However, the plugin that ewaller suggested would presumably be a more elegant solution.

I still don't know what you are trying to achieve, though. hmm


pkgs │ hacks │ cfg │ blag

Offline

#6 2016-01-02 00:21:52

bordot
Member
Registered: 2016-01-01
Posts: 3

Re: Possible to create a script to restart Chromium?

ayekat wrote:

Yes, if you set "http://google.com/" as the $url, it should do that. However, the plugin that ewaller suggested would presumably be a more elegant solution.

I still don't know what you are trying to achieve, though. hmm

After running for many hours, Chromium will sometimes crash and the tabs will freeze until they are restarted. I am just looking for a way to restart them automatically every 1 hour so that a tab won't be crashed without me knowing about it. I'm running many servers each with their own Chromium browser, so it can be quite difficult to keep checking them to ensure everything is OK. Does that clear things up?

Offline

#7 2016-01-02 02:24:10

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Possible to create a script to restart Chromium?

Maybe you should find out why Chromium crashes, and do something about it?

Also I'm curious - why are you running browsers on servers?

Offline

Board footer

Powered by FluxBB