简体   繁体   中英

Running Script not showing on EC2

I just installed all necessary dependencies on a new AWS EC2 Linux 2 server and launch my long_running_script.py. This script essentially performs a few operations then sleeps for a few hours on a never ending loop.

When I launched the script initially, I saw the correct output and all was fine. I disconnected from the instance, and when I reconnected I expected to see the same output as before.

Instead I can't seem to see any script output or see it running after typing in the 'ps aux' command.

Did disconnecting from the instance somehow abort the script? If so, how can I make sure it stays running?

Appreciate your help.

Did disconnecting from the instance somehow abort the script? If so, how can I make sure it stays running?

Yes it did. There are many ways to solve this. You can launch it using tmux or screen . Lunching your program in these "shells" will keep it running after you log out.

There is also nohup and pm2 which could also be helpful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM