So far I am just simply open 2 sessions(I've got 2 bots so far) in macOS 'Terminal' and run the bots.
May I know if there is better way to make those bots alive? Is that the normal way that most of the people will do in this way?
Like this, once the bot is started, then I will just leave the session here for listening the requests.
Thanks all.
Way 1: Run inside docker container
You need to install docker Desktop at your Mac and run each python script in separate container
Pros:
Cons:
Way 2: Run as daemon process inside Linux Virtual Machine [VM]
You need to install hypervisor (VirtualBox for example) and install Linux on it. After that use it like server for python scripts.
Pros:
Cons:
Way 3: Run process in background detached from terminal
Just run nohup pyton3 /Users/ws_fingear/Documents/workspace/Telegram_Bot/Telegram_Bot_WSFG1.0.py > output.log &
. Mark &
means that process will be run in background and continue to run even if you close terminal. Output will be printed out inside output.log
file
Pros:
Cons:
I guess, you looking for way 3.
Also you can use syncthing on Mac OS to run script as daemon locally