9bfacfceae9016cdfba93b6e415d7ead14ec2536
[libremanage.git] / libremanage.py
1 """
2 libremanage - Lightweight, free software for remote side-chanel server management
3
4 Copyright (C) 2018 Alyssa Rosenzweig
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Affero General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Affero General Public License for more details.
15
16 You should have received a copy of the GNU Affero General Public License
17 along with this program. If not, see <https://www.gnu.org/licenses/>.
18 """
19
20 import sys
21
22 USAGE = """
23 Usage:
24
25 $ libremanage [server name] [command]
26
27 Example:
28
29 $ libremanage web2 reboot
30
31 Server names are defined in the accompanying config.py.
32
33 Valid commands are as follows:
34
35 - shutdown, reboot, poweron: Power management
36 """
37
38 if len(sys.argv) != 3:
39 print("Incorrect number of arguments")
40 print(USAGE)
41 sys.exit(1)
42
43 def issue_command(server_name, command):
44 print(server_name, command)
45
46 issue_command(sys.argv[1], sys.argv[2])