27 Nov 2014
If you are handling remote server using ssh, you may require this. Last week I was trying to run my meteor application on the server using ssh. I started the meteor app on the server using ssh. But when I logged out from the ssh console, the meteor app stopped. I wanted a solution to run a background process in the server. So that the process I started won’t exit even If I logged out from the ssh console. The following commands worked:
First, I started the process(for me its my meteor app) as background process using &
at the end of command as shown below:
$ meteor -p 4040 >> ~/myapp.log &
Then I got the output with the processId, like this:
$ meteor -p 4040 >> ~/myapp.log &
[1] 11436
which shows two things [1]
is the job-number for the background job and the 11436
is the pID for that particular job
Now use the $ bg
command to move the job to background, bg resumes the suspended process in the background.
Now use disown command to remove the process from job table, so that the process will be running in the background even when we logged out from the ssh console.
The %1
is the job number to be removed from the job table, which we can get either from the output of the first command or you can use the $ jobs
command to find the job number. which lists the status of all running jobs with their job number.
23 Nov 2014
There are situations in which we will get this error message.
the port is already in use
This occurs when we are trying to install or execute something, and after some searching I found the following commands, to find the process which uses a particular port. I am adding the commands to kill that (if required), most of the time I do so.
So open a terminal window by pressing ctrl + alt + t
.
These are the commands to find which process is using port 3000
.
$ sudo netstat -tulpn | grep 3000
Netstat is a command-line tool that displays network connections for the Transmission Control Protocol, routing tables, and a number of network interface and network protocol statistics.
The above command may ask you for administrator password. It gave me this output.
$ sudo netstat -tulpn | grep 3000
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 19911/node
The options used with netstat are:
t : Display tcp connections.
u : Display udp connections.
p : Display the process using the socket.
n : Display the addresses and ports in numeric form.
A node server script is running with PID 19911
, to kill that I use :
So port 3000
on my system is free now :)
22 Nov 2014
This post is about how I started blogging using my favourite text-editor and Markdown. Earlier I was using the Blogger and Wordpress. But it is very difficult to edit on WYSIWYG editor. Especially when you are adding code-snippet or commands.
Finally I got Poole, which is a butler for Jekyll. Jekyll is a static site generator, an open-source tool for creating simple yet powerful websites of all shapes and sizes.
This is what I did.
Since github provides free hosting for sites developed in Jekyll, as github pages at gihub.io. As a first step to create github page, I just created a repo with <my-github-username>.github.io
here.
Then cloned the repo to my system, and downloaded the Lanyon Poole theme from here. Extracted the Lanyon files to my repo ~/sujith3g.github.io/
.
Then pushed the changes to my repo, after sometime my github page was up and running sujith3g.github.io.
It was the default data provided by Poole. After reading this tutorial for several minutes. I have changed some basic configurations like Title,Author Name,etc. And started writing this post using my Sublime-text.
Thanks!