And, being able to run node.js from Raspberry Pi is quite useful. In order to keep the node.js running, even after I quit the ssh session, I wanted something, like ‘screen’ unix command. Finally, I ended up choosing tmux than screen, as tmux appears to be a modern equivalent with active development going on..
Btw, I used the ArchLinux Arm, instead of raspbian, as I liked the fact it is a rolling release distro, which also I wanted to experiment with. (Having used Debian/Ubuntu for a long time now)
Anyway, coming to the point, the process is quite easy for using tmux from cherrypy.
ssh server was already installed with Archlinux ARM. So, this step is taken care. (If not, just install an ssh server, like openssh)
The next step is to install tmux.
Use pacman to install tmux..
sudo pacman -S tmux
Now, from my other machine (I typically use ConnectBot in my Android Phone/tablet, with Hacker’s keyboard for better keyboard experience), connect to the Raspberry Pi device, and just type
This creates a new tmux session in Raspberry Pi. Here we need to run the necessary commands, say, run the node.js app.
Once we are done, just execute the following keyboard combination, to detach the tmux session.
Ctrl + B D (i.e., Press Ctrl + B and then press key D)
Please note, the tmux session still continues to run in the Raspberry Pi device 🙂
Now, if we need to login back after some time and attach to the tmux session..
That’s it. Now, our shell will be connected to the old tmux session, as if we were still continuing to operate. Isn’t it cool 🙂
I’m loving it. Especially, now I can use my Pi for downloading stuff, without having my main pc switched on all the time..