so I have a script running on (script is inside the instance) my AWS EC2 instance (Ubuntu), which should write some results of benchmarks into a txt file (also in the instance itself) every few hours...Now I have run the session with my terminal and ssh, but if I close my terminal or shut down my computer, the script obviously crashes. I have even tried: "nohup myscript.py &", but without any success.
Would really appreciate some help here
Set up an AWS EC2 Instance 2. Access and use Python in the AWS Command Line Interface (CLI) 3. Run a Python program within AWS EC2 Instance Sign up for an AWS Account.
Walkthrough: Use the AWS CLI with Run Command. Step 1: Getting started. You must either have administrator privileges on the instances you want to configure or you must have been granted the ... Step 2: Run shell scripts to view resource details. Step 3: Send simple commands using the ...
Please keep in mind that shutting down AWS EC2 machine also kills screen/tmux session and your script won't be restored after starting that machine again.
The instance ID is available from the Amazon Elastic Compute Cloud (Amazon EC2) console. Using Run Command and the AWS-RunShellScript document, you can run any command or script on an Amazon EC2 instance as if you were logged on locally. Run the following command to view a description of the Systems Manager JSON document.
Like mentioned above, start a tmux window like on your Amazon ec2 instance:
tmux new -s mywindow
Once the new window starts, run your script. Once the script is running, you can close your ssh client or shut down your local computer. When you want to see the results, log in to your ec2 through ssh again, and type this:
tmux a -t mywindow
This would take you back to your original window running your script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With