简体   繁体   中英

Restart Firefox and Restore Previous Session - Python

I have a problem with firefox - after a while it's slowing down but after restart it's good again. i tried flush dns - doesn't work. Celar Cache - doesn't work. So i'd like to make a python script that restart Firefox every 30 minutes and restore previous session, but i have no idea how to do it.

I tried any possible Firefox Tweak - none works.

Or maybe you know how to solve this problem.

well didn't find answer so i solved it by myself.

if you have a problem with Firefox performance it will help a lot.

https://github.com/perdubaro/FirefoxRestarter

import subprocess
import time
import os

browserExe = "firefox.exe"


def ffrestart():
    while True:
        print("\nClosing Firefox\n")
        os.system("taskkill /f /im "+browserExe)
        print("\nWaiting 5 seconds...\n")
        time.sleep(5)
        p = subprocess.Popen(['C:\Program Files\Mozilla Firefox\\firefox.exe'], shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT, bufsize=0)
        print(p)
        print("\nWait 1 hour for next Restart\n")
        time.sleep(3600)


ffrestart()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM