I have searched everywhere but can't seem to find an answer to this question.

If I am logging into my raspberry pi via ssh on my LAN, how do I start an application from the terminal? I'm not interested in using the application or viewing it from my computer, I just want to start it so it is running on the raspberry pi.

All the information I could find was related to people wanting to actually use the application GUI on their host computer or TV etc., but I don't need that function.

If I enter the application name in the terminal, it just tells me that I can't open the display which isn't what I want.

you can then run your X apps (such as pcmanfm &) so the output pops up on your Linux screen

I'm trying to run an application that is installed on the raspberry pi, not on the computer I am using to ssh into the pi. I just want to ssh into the pi, start Calibre so it is running and leave it running. Then end my ssh session and be done with Calibre left running on the pi.

• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

blackpoll wrote:
If I am logging into my raspberry pi via ssh on my LAN, how do I start an application from the terminal? I'm not interested in using the application or viewing it from my computer, I just want to start it so it is running on the raspberry pi.

If this is a GUI (X) application and you want it running on the Pi's display try the following

-X Enables X11 forwarding. This can also be specified on a per-host
basis in a configuration file.

X11 forwarding should be enabled with caution. Users with the
ability to bypass file permissions on the remote host (for the
user's X authorization database) can access the local X11 display
through the forwarded connection. An attacker may then be able
to perform activities such as keystroke monitoring.

For this reason, X11 forwarding is subjected to X11 SECURITY
extension restrictions by default. Please refer to the ssh -Y
option and the ForwardX11Trusted directive in ssh_config(5) for
more information.

leaves the app running in background
(May work with calibre, not tried)
or
Use a utility such as "screen" which probably won't do this (keeping app open) as it is for reconnect I believe (I don't use it), the application will stop as soon as you disconnect your ssh session.

Perhaps some more clarification would be helpful and others may want to do this. Calibre will automatically monitor and download all RSS feeds of your choice and automatically email them to your Kindle.

The purpose of leaving it running on a headless pi is to perform the above for me.

Yes, I can just plug in a monitor to the pi and start calibre, and then unplug the monitor and leave the pi running. But it would be easier for me to SSH into the pi and start calibre without having to use a monitor.

I'm using Ubuntu 16.04 on my main machine that I would use to ssh into the pi. I would have to end my ssh session and close the terminal however leaving calibre running on the headless pi.

First, let me say that this thread is a lot like another one, where I gave pretty much the same advice.

Second, I think that the real, long term, answer to your question is to figure out how to make this program run automatically on startup. Unless there is something you haven't told us yet, there doesn't seem to be any reason why you need to launch it manually - that is, launch sometime after the machine is powered on.

That said, the next key question is: Does this program *require* a GUI - that is, will it fail to launch if it is not connected to an X session? Will the program crash ("abend") if the X GUI goes away sometime after launch?

If the answer to all of these questions is "Yes", then you probably will need to investigate a VNC-type solution - that is, where you connect in via VNC, with a full X session going, launch the program, then disconnect from VNC, leaving the stuff running on the "virtual" X display. Note that you could actually do it either way - either the "x11vnc" way or the "virtual" way. Either way should work.

If not, though, then a SSH/screen approach would probably work. That is, if you can get the program to run without needing a GUI.

blackpoll wrote:Perhaps some more clarification would be helpful and others may want to do this. Calibre will automatically monitor and download all RSS feeds of your choice and automatically email them to your Kindle.

The purpose of leaving it running on a headless pi is to perform the above for me.

Yes, I can just plug in a monitor to the pi and start calibre, and then unplug the monitor and leave the pi running. But it would be easier for me to SSH into the pi and start calibre without having to use a monitor.

My answer above does exactly that as long as you have an X server (and probably a logged in session) on the Pi. If you don't have a logged in X session running on the Pi you'll have issues running any gui application.

A better solution might be looking for an alternative application that does the same thing but that doesn't need a gui. Running an X server and gui that never get looked at seems fairly wasteful of resources.

blackpoll wrote:Perhaps some more clarification would be helpful and others may want to do this. Calibre will automatically monitor and download all RSS feeds of your choice and automatically email them to your Kindle.

The purpose of leaving it running on a headless pi is to perform the above for me.

Yes, I can just plug in a monitor to the pi and start calibre, and then unplug the monitor and leave the pi running. But it would be easier for me to SSH into the pi and start calibre without having to use a monitor.

My answer above does exactly that as long as you have an X server (and probably a logged in session) on the Pi. If you don't have a logged in X session running on the Pi you'll have issues running any gui application.

A better solution might be looking for an alternative application that does the same thing but that doesn't need a gui. Running an X server and gui that never get looked at seems fairly wasteful of resources.

blackpoll wrote:Perhaps some more clarification would be helpful and others may want to do this. Calibre will automatically monitor and download all RSS feeds of your choice and automatically email them to your Kindle.

The purpose of leaving it running on a headless pi is to perform the above for me.

Yes, I can just plug in a monitor to the pi and start calibre, and then unplug the monitor and leave the pi running. But it would be easier for me to SSH into the pi and start calibre without having to use a monitor.

My answer above does exactly that as long as you have an X server (and probably a logged in session) on the Pi. If you don't have a logged in X session running on the Pi you'll have issues running any gui application.

A better solution might be looking for an alternative application that does the same thing but that doesn't need a gui. Running an X server and gui that never get looked at seems fairly wasteful of resources.

Martin Frezman wrote:That's why any "solution" based on -X or -Y is obviously wrong for your use case. These responses (the ones mentioning -X or -Y) should be ignored.

You would do well to try to follow along with the advice I posted recently. Can you answer the questions posted therein? Thanks.

I didn't know the answer to the question about requiring a GUI or not but now I know. I followed your advice to login via VNC, started Calibre, and then exited the VNC session. It appears calibre is running successfully on the pi and the GUI did not pop up on the pi. So your solution has worked!

Please let me know if the above solution is a good way of doing VNC or if there is a "better" way.

I looked at it - it looks fine. Some might say it is a little dated and that there are better ways (such as the newly revised and flashy "Real" VNC that comes with the latest Jessie), but it is certainly good enough for your purposes.

It seems you can run the web interface headless...... as mentioned by dasmanul above

Thank you for posting this tutorial, however, it is only for eBook management. My original post states that I use Calibre for automatic RSS feed download and automatic email to my kindle. I was not able to find any documentation on this feature with the server unless I am mistaken.