syncthing: callback descriptions

This commit is contained in:
enkore 2016-01-31 18:33:34 +01:00
parent 5959ba9463
commit b3a1ab2508

View File

@ -97,24 +97,31 @@ class Syncthing(IntervalModule):
# Callbacks # Callbacks
def st_open(self): def st_open(self):
"""Callback: Open Syncthing web UI"""
user_open(self.url) user_open(self.url)
def st_restart(self): def st_restart(self):
"""Callback: Restart Syncthing""""
self.st_post('/rest/system/restart') self.st_post('/rest/system/restart')
def st_stop(self): def st_stop(self):
"""Callback: Stop Syncthing"""
self.st_post('/rest/system/shutdown') self.st_post('/rest/system/shutdown')
def st_start_systemd(self): def st_start_systemd(self):
"""Callback: systemctl --user start syncthing.service"""
call(['systemctl', '--user', 'start', 'syncthing.service']) call(['systemctl', '--user', 'start', 'syncthing.service'])
def st_restart_systemd(self): def st_restart_systemd(self):
"""Callback: systemctl --user restart syncthing.service"""
call(['systemctl', '--user', 'restart', 'syncthing.service']) call(['systemctl', '--user', 'restart', 'syncthing.service'])
def st_stop_systemd(self): def st_stop_systemd(self):
"""Callback: systemctl --user stop syncthing.service"""
call(['systemctl', '--user', 'stop', 'syncthing.service']) call(['systemctl', '--user', 'stop', 'syncthing.service'])
def st_toggle_systemd(self): def st_toggle_systemd(self):
"""Callback: start Syncthing service if offline, or stop it when online"""
if self.online: if self.online:
self.st_stop_systemd() self.st_stop_systemd()
else: else: