we start cloud9 ide on terminal open to global by running
/usr/local/cloud9/bin/cloud9.sh -l 0.0.0.0 -w /root/workspace --username xxxx --password yyyy
this runs the port but when terminal is closed the app closes.. how to keep it running or how to make the app start and be ready on automatically..
If you are using linux os that you can copy and paste this command into /etc/init.d/rc.local.sh this file. So, whenever you are rebooting your machine at that time this command will execute.
And you have use && this double and symbol of end the command so even if you close the terminal also the app will work.
And, if you want to stop the node process excute this command ps -e|grep node and you'll get the node process ID and execute Kill processid command to stop the app.
Related
I am working with Docker and I run a command that gets me to Docker's log - seems like. When I'm in, I cannot get back to shell prompt. I suspect it might be something with the com.docker.cli although docker-docs do not say much about an audacious exit.
I've tried everything I could find, see list. A way to reproduce the issue is:
docker run -e MYSQL_ROOT_PASSWORD=mypassword mysql
Pressing Ctrl + opt (Alt) + T brings the process running.
Tried
exit
exit()
exit N
Ctrl + C
Ctrl + Z
Ctrl + X
Ctrl + \
Ctrl + Q
Ctrl + S
(The above with Ctrl, also with opt and cmd without cmd+Q
which will quit Terminal)
q
:q
q!
Ctrl + D
q()
quit
echo $ ?
Esc
!!
Hello Kitty ^-^
All this and others and a nice combination of them.
I recommend to reproduce the issue with Docker and Terminal with the command above and get there to figure out some solutions.
The idea is to learn more about This log in Terminal and how to exit and get back to shell prompt.
Thank you in advance!
In a separate terminal window, run docker ps. Look for a line there for a running container, with an autogenerated name, and the image mysql. That's the container you manually docker run.
Still in that separate terminal window, run docker stop adjective_name with the generated container name (or, equivalently, the 12-hex-digit container ID). This should bring back the shell prompt in the first terminal window. You can then docker rm adjective_name to clean up the stopped container.
For next time:
You can explicitly docker run --name to specify the name used for the container; you can then use that name with all docker commands.
You can use docker run -d to start the container in the background, and then docker logs container_name to see its logs.
You can alternately use docker run -it to connect the container's stdin to the console, and then Ctrl+C should work normally.
You can't really do much typing at the console of a database server, so I'd usually recommend launching it in the background. You can use the ordinary mysql command-line client from your host to interact with it (make sure to add a docker run -p option to make its port accessible).
Run container in background using detached mode.
-d option of docker run command should work.
docker run -d -e MYSQL_ROOT_PASSWORD=mypassword mysql
This will run container in background, check if its running and capture the container id using docker ps.
Now to get into the shell of running container use docker exec command.
docker exec -it <container-id> /bin/sh
To check logs use docker logs <container-id> command, assuming you installed docker with default json-file log driver.
It sounds like running from within a tmux might be a good bet for you, unless I'm misunderstanding what you mean. Then you can exit and come back to what was running without stopping the process you started from the command line.
I am currently using visual studio build an console applocation that has docker support, the problem with this is the application does not seem to start in a external command prompt, but the
seem to outputting in the internal console window of visual studio, how do i make it execute in a command prompt window?
It seems that the commands it uses forces it to outputted into the dev console window
docker exec -i -w "/app" b6375046a58cba92571a425d937a16bd222d87b537af1c1d64ca6b4c845616c9 sh -c ""dotnet" --additionalProbingPath /root/.nuget/fallbackpackages2 --additionalProbingPath /root/.nuget/fallbackpackages "bin/Debug/netcoreapp3.1/console.dll" | tee /dev/console"
how do i the exec command line such that it outputs to a different window?
And is it somehow possible to deploy these containered application into an locally running kubernetes cluster?
Thus utilizing kubernetes services - instead of specifying ip address and etc?
There is no meaining "different window".
You can run your app in foreground or in detached mode(-d).
To start a container in detached mode, you use -d=true or just -d option.
In foregroung you shouldn't spesified the -d flag
In foreground mode (the default when -d is not specified), docker run can start the process in the container and attach the console to the process’s standard input, output, and standard error
And, of course, you can deploy your applications into kubernates cluster. Without any troubles try minikube to achieve all what you need.
And kubernets services that is another way to represent your app to the world or other local place.
An abstract way to expose an application running on a set of Pods as a network service.
When I use a normal terminal in linux, I can use the up arroy key to navigate between previous command that I executed. I need do the same in a container in docker.
Ex:
Login to the container work space with this command:
/usr/bin/winpty.exe docker-compose exec workspace bash
Then, In the workspace container I run something command like this:
composer self-update
And then I close the current session, The next time that I try to repeat the same steps whenever I'm logged in the container, the prompt history doesn't have any commands saved.
I use laradock in windows.
After that I searched more about this problem, I found this reports in git-hub
https://github.com/moby/moby/issues/13817
https://github.com/Maximus5/ConEmu/issues/183
Finally the problem for me was the client that I used (git-cli). I change to (Powershell) and it works perfectly. Putty it's too an alternative to connect to docker environment.
I have a node docker container on which i'm running a dev server.
In my docker-compose.yml file, the entry command is :
...
command: start-dev-server
...
Where start-dev-server points to a script that starts the server after a vendor install :
// /usr/local/bin/start-dev-server
#!/usr/bin/env bash
# install node modules if missing
npm i
# start the dev server
npm run start
So when I start my container, the server will also start.
I know that I can access my container in bash via the following command :
docker exec -it my-container bash
But there I can't stop or restart my server.
Is there a way to access the ssh with the started command ? (to see the server logs for example, or to stop & restart it).
Maybe I take it by the wrong path here because the entry command isn't supposed to be stopped ? So in this case, would anyone has a solution that could allow me to start my server & control it in a more flexible way ?
The best practices says that you should see the container as your server. If you want to stop it, stop the container (docker stop my-container), if you want to restart it, restart the container (docker restart my-container). Your server should log to stdout, so you can see the logs using docker logs -f my-container. So, you're right, the command isn't supposed to be stopped, as it will stop the container.
To run the Rails server, I use $rails server. It says 'To stop, click Ctrl+c'.
I use Putty.
The questions are:
Should I keep the terminal open always? Because if the server stops, my web page wouldn't work. With Apache I just used commands apachectl start/stop.
What if I want to use a command? Should I stop the server, use command, and run again? Because in the same terminal I can't do enything if the server run.
you can run it in background by writing
daemonize true
in your puma.rb file
To stop you need to find your running puma process
ps aux | grep puma
then you need to kill the main process
sudo kill -9 your process id
to start you need to type
puma -C config/puma.rb
You can start a daemonized server by adding -d to your command. For instance:
rails server -d
To stop the server, you can kill it based on its process id:
kill $(cat tmp/pids/server.pid)
Should I keep the terminal open always? Because if the server stops, my web page wouldn't work. With Apache I just used commands apachectl start/stop.
Yes, you should keep it open because if you Ctrl C it will stop the server. Another option is to run it in the background but I'm not sure how to do that in Putty.
What if I want to use a command? Should I stop the server, use command, and run again? Because in the same terminal I can't do enything if the server run.
Can you open another terminal window? If you have two terminal windows you can use one for running the server and another for other tasks.