1#!/usr/bin/env python 2# -*- coding: utf-8 -*- 3 4# Copyright (C) 2018 Mate Soos 5# 6# This program is free software; you can redistribute it and/or 7# modify it under the terms of the GNU General Public License 8# as published by the Free Software Foundation; version 2 9# of the License. 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 General Public License for more details. 15# 16# You should have received a copy of the GNU General Public License 17# along with this program; if not, write to the Free Software 18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19# 02110-1301, USA. 20 21import boto.utils 22import os 23 24user_data = boto.utils.get_instance_userdata() 25 26todo = "" 27for line in user_data.split("\n"): 28 if "DATA" in line: 29 todo = line[5:].strip().strip('"') 30 31if todo == "": 32 exit(0) 33 34os.chdir("/home/ubuntu/cryptominisat/scripts/aws/") 35command = "nohup /home/ubuntu/cryptominisat/scripts/aws/server.py %s &" % todo 36os.system(command) 37