how to automatically restart an application that stop

Hi, on my desktop PC I use krfb desktop sharing to operate on it when I am far form home, sometimes I fount that krfb is closed, how can I do something (may be a script or something other) that check if krfb is on or off and if it is off restart krfb?

Is is started with a systemd service, if so configure the service to auto restart, but you need to figure out why it’s stopping before doing that…

Looks pretty old fashioned, no unit file available:

**erlangen:~ #** rpm -ql krfb 
**erlangen:~ #**

Users may need to create their own service such as I did:

karl@erlangen:~> ll .config/systemd/user/save-jalbum-settings.service 
-rw-r--r-- 1 karl users 150  4. Jan 2018  .config/systemd/user/save-jalbum-settings.service 
karl@erlangen:~> systemctl --user cat save-jalbum-settings.service  
**# /home/karl/.config/systemd/user/save-jalbum-settings.service**

Description=Save jAlbum Project Files 

ExecStart=/bin/bash /home/karl/bin/ 


It never failed since January 2018.

I don’t know, I start it in kde autostart or manually

So that requires the system has a user logged in. If the user gets logged out it will stop, is that what is happening?

If a systemd service (you would need to craft your own), then could be run via the --user option… but again, user logged out, it won’t work.

Perhaps you should be looking at a solution (eg vnc) that you could get a log in screen and log in that way?

not, it need that a user is logged in, the user doesn’t log out, but it stops I don’t know why

it could be good becouse the user doesn’t log out, I will try to write a systemd service

is there vnc for linux that works in this way? I only know krfb that I supposed was the vnc for linux…

well, reading around it seems that I have toinstall a vnc server like tigervnc on my server and connect with a client like remmina or others

This will help only if program crashes (process terminates), not if program simply stops responding. At the very least you should have logged in using ssh and check the state of your program.

it seems that it close or crashes, if I launch again krfb it works again.
the ssh login could be an idea, I can login, but I don’t know how to launch krfb in the user logged in graphic session

I succeeed to connect via ssh as user, then I tried

krfb --display :0

and it worked for connection via KRDC to my desktop, I didn’t find all the applications that was opened in the session as before but it worked