From 79b260db495e94430d499906f321dc022c68fec1 Mon Sep 17 00:00:00 2001 From: ficus Date: Tue, 25 Sep 2012 15:59:18 +0200 Subject: basic tor control (needs testing) --- torouterui/util.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'torouterui/util.py') 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) -- cgit v1.2.3