Last active
February 16, 2018 16:17
-
-
Save dJani97/e6723b8c818fa8c03dd427d54115c989 to your computer and use it in GitHub Desktop.
Dropbox Restarter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Simple Python3 script that checks if your Dropbox Linux desktop client is running, and restarts it if it's stopped. | |
You may start the script from a systemd unit file, or execute it with another tool on system startup (eg. KDE autostart) | |
""" | |
import tkinter | |
from tkinter import messagebox | |
import subprocess | |
import time | |
sleep_seconds = 30 | |
while True: | |
time.sleep(sleep_seconds) | |
output = subprocess.check_output(['ps', '-A']) | |
if "dropbox" not in str(output): | |
root = tkinter.Tk() | |
root.withdraw() | |
answer = messagebox.askyesno("Dropbox has stopped!", "Dropbox service has stopped!\nWould you like to restart it?") | |
root.destroy() | |
if answer: | |
subprocess.call(['dropbox', 'start'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
I wrote this script because my Dropbox client often stopped on my KDE desktop, and I got tired of loosing parts of my work all the time.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simple Python3 script that checks if your Dropbox Linux desktop client is running, and restarts it if it's stopped.
You may start the script from a systemd unit file, or execute it with another tool on system startup (eg. KDE autostart)