LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-30-2014, 03:36 AM   #1
bbb13
Member
 
Registered: Mar 2012
Distribution: Manjaro XFCE 0.8.10, Fedora 19 XFCE, Fedora 20 Cinnamon
Posts: 41

Rep: Reputation: Disabled
automatic restart of crashed apps on Fedora


Is there an option to add in my .desktop file to make vino-server automatically restart after crashing??
Using Fedora 19 x64 XFCE

Code:
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=vino
Comment=
Exec=/usr/libexec/vino-server
OnlyShowIn=XFCE;
StartupNotify=false
Terminal=false
Hidden=true
thnx in advance
 
Old 07-30-2014, 07:52 AM   #2
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
no but you can create a cron script that would check ps -ef for the file/service and if not found execute the service.
 
Old 07-30-2014, 07:54 AM   #3
bbb13
Member
 
Registered: Mar 2012
Distribution: Manjaro XFCE 0.8.10, Fedora 19 XFCE, Fedora 20 Cinnamon
Posts: 41

Original Poster
Rep: Reputation: Disabled
any guidance?
 
Old 07-30-2014, 06:28 PM   #4
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
for what part? the bash scripting or cron? both are out there with loads and loads of examples.

https://www.google.com/search?q=basi...m=119&ie=UTF-8

https://www.google.com/search?q=basi...=crontab+howto

what have you tried? what have you done to research this? post your code, folks will be happy to help, but not do the work for you.
 
Old 07-31-2014, 06:53 AM   #5
bbb13
Member
 
Registered: Mar 2012
Distribution: Manjaro XFCE 0.8.10, Fedora 19 XFCE, Fedora 20 Cinnamon
Posts: 41

Original Poster
Rep: Reputation: Disabled
i wasnt asking anyone to do the work for me, just a little guidance for cron jobs cause i never used them. is it possible to run vino as a systemd service and add the Restart=on-failure parameter to do the job?
 
Old 07-31-2014, 11:01 AM   #6
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
possibly sadly i dont know a lot about the new systemd or how it functions yet. thus my simple recommendations of cron + bash script.
 
Old 07-31-2014, 11:32 AM   #7
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
The most trivial would be to use a script to start it:

Change the "Exec=" line from "/usr/libexec/vino-server" to something like "/home/<username>/<your path>/mystart_vino-server

And create an executable scrip "/home/<username>/<your path>/mystart_vino-server

With the contents of:

Code:
#!/bin/bash
while 1; do
    /usr/libexec/vino-server
done
Thus, whenever vino-server terminates, it is restarted.

Of course, stopping it might be a bit of an issue...
 
Old 07-31-2014, 11:39 AM   #8
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Do we know why it crashes?

Long term it may be better to work out why it crashes and fix..

But both the cron and the while loop are solutions
 
Old 08-01-2014, 01:34 AM   #9
bbb13
Member
 
Registered: Mar 2012
Distribution: Manjaro XFCE 0.8.10, Fedora 19 XFCE, Fedora 20 Cinnamon
Posts: 41

Original Poster
Rep: Reputation: Disabled
fedora and vino-server never got along..you have authentication issues, crash issues etc. used to have the exact same setup in my server but instead of fedora x64 i had fedora x86 (because of my cpu). vino never crashed but took me forever to set it start on boot, again for no obvious reasons. in x64 i even tried running vino-server manually from ssh and connect from ultravnc and it just stop working after a couple of minutes without giving anything in the terminal,and couldnt connect anymore, only after rebooting the server. its a massive headache. i didnt find any log either for explaining why it crashes, it just does. anyways, i'll try the bash script and report back.

i'll be moving to centos soon so hopefully vino will work flawlessly there.
 
Old 08-01-2014, 05:24 AM   #10
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
This script gives you a 5 second 'window'
Code:
#!/bin/bash
while true; do
    /usr/libexec/vino-server
    for i in {1..5};do
        sleep 1
        printf "."
    done
    printf "\n"
done

This script starts a gnu screen session ( as required ), and then starts the 'VinoScript'
Code:
#!/bin/bash
grep -q Vino <<<$(screen -ls) || (
screen -s /bin/bash -dmS Vino -t Vino
)
screen -S Vino -p 0 -X stuff $'/path/to/VinoScript.sh\n'

Alternatively
Code:
#!/bin/bash
while true; do
    /usr/libexec/vino-server
    (( $? == 0 )) && break
done
This assumes a 'normal' shutdown gives exit 0, and a 'crash' gives exit of none-zero
should it exit normally we break out of the loop, else we carry on looping

You could either 'set up' a screen session, or use coproc so you don't need a term/console 'open'


Code:
#!/bin/bash
coproc Vino (
    while true; do
        /usr/libexec/vino-server
        (( $? == 0 )) && break
    done
)
 
Old 08-07-2014, 03:02 AM   #11
bbb13
Member
 
Registered: Mar 2012
Distribution: Manjaro XFCE 0.8.10, Fedora 19 XFCE, Fedora 20 Cinnamon
Posts: 41

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
The most trivial would be to use a script to start it:

Change the "Exec=" line from "/usr/libexec/vino-server" to something like "/home/<username>/<your path>/mystart_vino-server

And create an executable scrip "/home/<username>/<your path>/mystart_vino-server

With the contents of:

Code:
#!/bin/bash
while 1; do
    /usr/libexec/vino-server
done
Thus, whenever vino-server terminates, it is restarted.

Of course, stopping it might be a bit of an issue...
script worked as i wanted, thank you!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic Restart Fracker Linux - Server 1 05-25-2010 06:25 AM
Restart Program when crashed prudens Linux - Newbie 1 02-05-2010 12:58 PM
X Server Crashed and Can't Restart [Vector 6] adamnew123456 Linux - Software 1 12-16-2009 09:23 PM
fedora linux 8 crashed 7 grub loader displaying after restart jbind_007 Linux - General 1 04-13-2009 01:08 AM
Managing apps and restoring crashed apps in GNU/Linux aero_z Linux - Newbie 11 01-20-2009 02:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration