mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
deluge: Further improvements to actions
- Perform disable even when the service is not running. - Improve checking if deluge is enabled.
This commit is contained in:
parent
2f56a516de
commit
0335ee9c32
@ -26,8 +26,6 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
APACHE_CONF_ENABLED_PATH = '/etc/apache2/conf-enabled/deluge-plinth.conf'
|
|
||||||
|
|
||||||
SYSTEMD_SERVICE_PATH = '/etc/systemd/system/deluge-web.service'
|
SYSTEMD_SERVICE_PATH = '/etc/systemd/system/deluge-web.service'
|
||||||
SYSTEMD_SERVICE = '''
|
SYSTEMD_SERVICE = '''
|
||||||
#
|
#
|
||||||
@ -74,10 +72,12 @@ def parse_arguments():
|
|||||||
|
|
||||||
def subcommand_get_enabled(_):
|
def subcommand_get_enabled(_):
|
||||||
"""Get whether deluge-web site is enabled."""
|
"""Get whether deluge-web site is enabled."""
|
||||||
if os.path.isfile(APACHE_CONF_ENABLED_PATH) and \
|
try:
|
||||||
os.path.isfile(SYSTEMD_SERVICE_PATH):
|
subprocess.check_output(['a2query', '-c', 'deluge-plinth'],
|
||||||
|
stderr=subprocess.STDOUT)
|
||||||
|
subprocess.check_output(['systemctl', 'is-enabled', 'deluge-web'])
|
||||||
print('yes')
|
print('yes')
|
||||||
else:
|
except subprocess.CalledProcessError:
|
||||||
print('no')
|
print('no')
|
||||||
|
|
||||||
|
|
||||||
@ -124,10 +124,11 @@ def disable():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.check_output(['systemctl', 'stop', 'deluge-web'])
|
subprocess.check_output(['systemctl', 'stop', 'deluge-web'])
|
||||||
subprocess.check_output(['systemctl', 'disable', 'deluge-web'])
|
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
subprocess.check_output(['systemctl', 'disable', 'deluge-web'])
|
||||||
|
|
||||||
|
|
||||||
def setup():
|
def setup():
|
||||||
"""Perform initial setup for deluge-web."""
|
"""Perform initial setup for deluge-web."""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user