summaryrefslogtreecommitdiff
path: root/tools/halt.py
blob: 0cb43ed312f1f9ca386d3faf1f2e40486b4ee9fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014, NORDUnet A/S.
# See LICENSE for licensing information.

import argparse
import subprocess
import sys
import select

parser = argparse.ArgumentParser(description='')
parser.add_argument('toerl')
parser.add_argument('nodedir')
args = parser.parse_args()

p = subprocess.Popen(
    [args.toerl, args.nodedir],
    stdin=subprocess.PIPE)
p.stdin.write("halt().\n")
p.stdin.flush()
select.select([], [], [], 0.5)
p.stdin.close()
p.wait()