diff options
Diffstat (limited to 'python/reboot_hetzner_server.py')
-rw-r--r-- | python/reboot_hetzner_server.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/python/reboot_hetzner_server.py b/python/reboot_hetzner_server.py new file mode 100644 index 0000000..7452afe --- /dev/null +++ b/python/reboot_hetzner_server.py | |||
@@ -0,0 +1,18 @@ | |||
1 | import sys | ||
2 | import hetzner_helper | ||
3 | |||
4 | instance = sys.argv[-1] | ||
5 | actions = [] | ||
6 | if "--rescue" in sys.argv: | ||
7 | actions.append("enable_rescue") | ||
8 | elif "--local" in sys.argv: | ||
9 | actions.append("disable_rescue") | ||
10 | |||
11 | if "--hard" in sys.argv: | ||
12 | actions.append("reset") | ||
13 | else: | ||
14 | actions.append("reboot") | ||
15 | |||
16 | for action in actions: | ||
17 | result = hetzner_helper.post("servers/{}/actions/{}".format(instance, action)) | ||
18 | print(result) | ||