I have 2 flask restful API's .
On my localhost, I open up a terminal and run uwsgi --ini /path-to-ini-file1
. For 2nd API, I open up yet agan a new terminal and run uwsgi --ini /path-to-ini-file2
.
In VPS, I have only a single ssh window.
How do I run those 2 on terminals in vps using ssh. Should I create a bin/bash script to achieve that?
Any suggestion would be appreciated, thank you.
Asked
Active
Viewed 943 times
0

ksalf
- 3
2 Answers
0
To run commands in background and do not have them attach to the terminal you need to use something like:
nohup uwsgi --ini /path-to-ini-file1 >out1.log 2>err1.log&
nohup uwsgi --ini /path-to-ini-file2 >out2.log 2>err2.log&
And you can run as many as need servers (limited by RAM and processor power).
And after you logour from the server you will have them run

Romeo Ninov
- 699
-
1.Thanks a lot for your answer, Sir. Trying right now, what you have just suggested – ksalf Apr 12 '19 at 13:34
0
If this is supposed to run on an unattended machine, make these a service, so that they are automatically taken care off (started,restarted, logged...). It is not difficult to make a systemd service.

xenoid
- 5,504
-
Thanks a lot for telling something new to me , Sir. Visited the link you posted, very knowledgeable. – ksalf Apr 12 '19 at 15:18
screen
tool. That allows you to have many sessions running at once, and they will survive disconnection / connection to your remote server / VPS. You might have to install screen on your VPS. – Soren A Apr 12 '19 at 13:23