aboutsummaryrefslogtreecommitdiffstats
path: root/torouterui/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'torouterui/util.py')
-rw-r--r--torouterui/util.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/torouterui/util.py b/torouterui/util.py
index dc3b6c0..c459fa0 100644
--- a/torouterui/util.py
+++ b/torouterui/util.py
@@ -17,6 +17,17 @@ def fs_read(path):
with open(path, 'r') as f:
return ''.join(f.readlines())
+def enable_service(name):
+ os.system('update-rc.d %s defaults &' % name)
+ # safe to "restart" most services if they are already running
+ os.system('/etc/init.d/%s start &' % name)
+
+def disable_service(name):
+ """Currently, this is never actually called"""
+ os.system('update-rc.d %s remove &' % name)
+ # safe to "restart" most services if they are already running
+ os.system('/etc/init.d/%s stop &' % name)
+
def prefix_to_ipv4_mask(prefixlen):
assert(prefixlen >= 0)
assert(prefixlen <= 32)