def install_nginx(): print('\n Proceedng with installation of nginx now using ssh...\n') cmd = " ssh -t -o StrictHostKeyChecking=no -i " + key + " " + full_remote_host + " 'sudo yum install -y nginx' " while run_remote_command( instance, cmd) == bool(0): #ssh remote function from ssh helper class run_remote_command(instance, cmd)
def install_python(): cmd = "ssh -t -i " + key + " " + full_remote_host + " 'sudo yum install -y python34'" run_remote_command(instance, cmd)
def make_executable(): cmd = "ssh -t -i " + key + " " + full_remote_host +" 'chmod 700 start_webserver.py'" run_remote_command(instance, cmd)
def copy_webserver_script(): cmd = "scp -i " + key + " start_webserver.py " + full_remote_host +":." run_remote_command(instance,cmd)
def install_nginx(): print('\n Proceedng with installation of nginx now using ssh...\n') cmd = " ssh -t -o StrictHostKeyChecking=no -i " + key + " " + full_remote_host + " 'sudo yum install -y nginx' " while run_remote_command(instance, cmd) == bool(0): #ssh remote function from ssh helper class run_remote_command(instance, cmd)
def nginx_log(): chown_cmd = "ssh -t -i " + key + " " + full_remote_host +" sudo chown ec2-user /var/log/nginx/" access_log_cmd = "ssh -t -i " + key + " " + full_remote_host +" cat /var/log/nginx/access.log" run_remote_command(instance, chown_cmd) run_remote_command(instance, access_log_cmd)
def run_webserver_script(): cmd = "ssh -t -i " + key + " " + full_remote_host +" python3 start_webserver.py" run_remote_command(instance, cmd)
def nginx_log(): chown_cmd = "ssh -t -i " + key + " " + full_remote_host + " sudo chown ec2-user /var/log/nginx/" access_log_cmd = "ssh -t -i " + key + " " + full_remote_host + " cat /var/log/nginx/access.log" run_remote_command(instance, chown_cmd) run_remote_command(instance, access_log_cmd)
def run_webserver_script(): cmd = "ssh -t -i " + key + " " + full_remote_host + " python3 start_webserver.py" run_remote_command(instance, cmd)
def make_executable(): cmd = "ssh -t -i " + key + " " + full_remote_host + " 'chmod 700 start_webserver.py'" run_remote_command(instance, cmd)
def copy_webserver_script(): cmd = "scp -i " + key + " start_webserver.py " + full_remote_host + ":." run_remote_command(instance, cmd)