diff options
author | ficus <ficus@robocracy.org> | 2012-09-25 15:59:18 +0200 |
---|---|---|
committer | ficus <ficus@robocracy.org> | 2012-09-25 15:59:18 +0200 |
commit | 79b260db495e94430d499906f321dc022c68fec1 (patch) | |
tree | 71b33694a9b9f7fc7f43b611191dc2cd5d1e1fc5 /torouterui/util.py | |
parent | fe4b8a01fc87d1a76fca8e8733270a260aa23cc0 (diff) | |
download | tui-79b260db495e94430d499906f321dc022c68fec1.tar.gz tui-79b260db495e94430d499906f321dc022c68fec1.zip |
basic tor control (needs testing)
Diffstat (limited to 'torouterui/util.py')
-rw-r--r-- | torouterui/util.py | 11 |
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) |