natxo
Posts: 29
Joined: Mon Sep 18, 2017 3:47 pm

ssh to current session

Sun Oct 01, 2017 5:26 pm

Hello

Im running an app which uses direct frame buffer draw, basically its a video player like hello_video example.

Its possible to ssh in that session?? Basically i want to be able to monitor if the app its running ok.

And no, i can not launch the app in "graphical mode in desktop" and access with vnc or similar, only access by ssh


Thanks!

Heater
Posts: 13603
Joined: Tue Jul 17, 2012 3:02 pm

Re: ssh to current session

Sun Oct 01, 2017 5:59 pm

Of course you can.

ssh does not care what kind of graphics you are doing.

Assuming you have ssh enabled you are good to go.
Memory in C++ is a leaky abstraction .

natxo
Posts: 29
Joined: Mon Sep 18, 2017 3:47 pm

Re: ssh to current session

Sun Oct 01, 2017 6:20 pm

Thanks!

But when i open a ssh connection, it does not open a new session?

I will try to explain....

I boot the pi, auto launch launch the app which render the video and verbose some messages behind the video layer. then i open a ssh connection from other computer and log on the pi but not see "those messages", seems like create a new session.

Heater
Posts: 13603
Joined: Tue Jul 17, 2012 3:02 pm

Re: ssh to current session

Mon Oct 02, 2017 2:14 am

That is correct. When you ssh into a machine you get a whole new user session.

How are you launching that program after boot up?

If it were me I would arrange to have it start automatically at boot time by creating a systemd service file for it.

Then all the output messages would be sent to the system log. /vat/log/syslog

From where they can be read from another login session.

Alternatively redirect the programs output to a log file of it's own. Be careful that file does not grow huge and eventually fill your SD card.

I wrote some instructions for using systemd to start applications at boot time here: viewtopic.php?t=138861
Memory in C++ is a leaky abstraction .

Martin Frezman
Posts: 1020
Joined: Mon Oct 31, 2016 10:05 am

Re: ssh to current session

Mon Oct 02, 2017 3:19 am

The most straightforward solution to this is to use Real VNC server/viewer and use the "low level" stuff in the Real VNC server. Then you should be able to VNC in from elsewhere and see exactly what is on the screen of the Pi.
If this post appears in the wrong forums category, my apologies.

Heater
Posts: 13603
Joined: Tue Jul 17, 2012 3:02 pm

Re: ssh to current session

Mon Oct 02, 2017 3:31 am

How is that "most straight forward"? That implies installing and configuring VNC on the Pi and any machine I want to access it from. Rather than just using the tools one has already.
Memory in C++ is a leaky abstraction .

jahboater
Posts: 4762
Joined: Wed Feb 04, 2015 6:38 pm

Re: ssh to current session

Mon Oct 02, 2017 8:08 am

RealVNC is included within Raspbian, it doesn't need to be installed.
But yes, you do need the client executable on your PC.
VNC does need to be enabled in raspi-config

Edit: I see the OP doesn't want to use VNC for some reason.

Don't you need to be on a Linux console to use the frame buffer directly?
Last edited by jahboater on Mon Oct 02, 2017 8:27 am, edited 1 time in total.

natxo
Posts: 29
Joined: Mon Sep 18, 2017 3:47 pm

Re: ssh to current session

Mon Oct 02, 2017 8:24 am

Heater wrote:
Mon Oct 02, 2017 2:14 am
That is correct. When you ssh into a machine you get a whole new user session.

How are you launching that program after boot up?

If it were me I would arrange to have it start automatically at boot time by creating a systemd service file for it.

Then all the output messages would be sent to the system log. /vat/log/syslog

From where they can be read from another login session.

Alternatively redirect the programs output to a log file of it's own. Be careful that file does not grow huge and eventually fill your SD card.

I wrote some instructions for using systemd to start applications at boot time here: viewtopic.php?t=138861

I tried to use systemd, in my app im using one of those csi auvidea capture board (a hdmi capture card that plug on the raspicam connector) and i was not able to make it work using systemd.... the app boots ok but get no signal video.

So i ended using /etc/profile to launch my app.

I can not start Xdesktop so no vnc its possible for me.

Heater
Posts: 13603
Joined: Tue Jul 17, 2012 3:02 pm

Re: ssh to current session

Mon Oct 02, 2017 9:13 am

The frame buffer device should be there and working no matter if you are logged in or not.

If your program works from the command line it must be possible to start it from systemd.

You might be interested in the "screen" command.

Screen allows you to log in, open a " screen" and start some program. Then you can log out and your program will still be running. Then you can log in again, connect to that "screen" and see it's console output.

https://www.linux.com/learn/taking-comm ... gnu-screen

Screen is nice but I would not use it for long term, final, solution.
Memory in C++ is a leaky abstraction .

natxo
Posts: 29
Joined: Mon Sep 18, 2017 3:47 pm

Re: ssh to current session

Mon Oct 02, 2017 1:51 pm

thanks

User avatar
HawaiianPi
Posts: 4726
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: ssh to current session

Mon Oct 02, 2017 10:12 pm

Heater wrote:
Mon Oct 02, 2017 9:13 am
Screen is nice but I would not use it for long term, final, solution.
Curious as to why you would say that?
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

Heater
Posts: 13603
Joined: Tue Jul 17, 2012 3:02 pm

Re: ssh to current session

Tue Oct 03, 2017 1:24 am

If the aim is to have a program running in the background from boot up then screen is not the way to do it.

All depends on what one actually wants to do.
Memory in C++ is a leaky abstraction .

Return to “General discussion”