LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 09-19-2008, 06:44 AM   #1
xtothat
Member
 
Registered: Sep 2008
Location: Middle of Nowhere, England
Distribution: Slackware 14.1, Ubuntu 13.10
Posts: 39

Rep: Reputation: 15
Get KDE program to run permanently.


Hi everyone, new member here.

I am trying to make a program run more reliably by making it restart if it closes (through crash or pressing the close button).

I have tried using BASH "while true" loops but haven't really had any success.

If anybody can think of any way this could be done. Preferably BASH or something in xinit, but I could use python or perl if necessary.

I'm using KDE 3.5 (if that makes a difference)

Anyway... If anybody can help at all I would be most grateful.

Thanks to any and everybody in advance!

X-T
 
Old 09-19-2008, 09:27 AM   #2
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 2,345

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
try monit. Hope it suit your needs
 
Old 09-19-2008, 09:57 AM   #3
xtothat
Member
 
Registered: Sep 2008
Location: Middle of Nowhere, England
Distribution: Slackware 14.1, Ubuntu 13.10
Posts: 39

Original Poster
Rep: Reputation: 15
Thanks!

Awesome! Looks like just what I need! Thanks for your speedy reply, your help is much, much appreciated!

X-T
 
Old 09-19-2008, 10:15 AM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946
Just for the record, why doesn't the while loop work for you? I've used it before myself with unstable programs, such as once when there was a bug in ktorrent that made it crash occasionally on my system. In that case I only had to do one other thing to make it work, and that was run it with the --nofork and --nocrashhandler options to keep it from launching as a background process and popping up the crash report dialog every time.
 
Old 09-22-2008, 08:52 AM   #5
xtothat
Member
 
Registered: Sep 2008
Location: Middle of Nowhere, England
Distribution: Slackware 14.1, Ubuntu 13.10
Posts: 39

Original Poster
Rep: Reputation: 15
Hi guys... Thanks for all your support... I've actually fixed my while loop. I was being an idiot and forgetting where I needed to put semicolons. Also a less pretty, but smaller (by a whole line of code ) way of doing it would be to do this:

Code:
#!/bin/bash
/path/to/program
/path/to/this/script
Anyway... Thanks again for everybody's help, and I hope that my membership will continue to be as enjoyable as this!

X-T

Last edited by xtothat; 09-22-2008 at 08:53 AM. Reason: My smiley looked all wrong!
 
Old 09-22-2008, 08:59 AM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,029

Rep: Reputation: 368Reputation: 368Reputation: 368Reputation: 368
Quote:
Originally Posted by xtothat View Post
Hi guys... Thanks for all your support... I've actually fixed my while loop. I was being an idiot and forgetting where I needed to put semicolons. Also a less pretty, but smaller (by a whole line of code ) way of doing it would be to do this:

Code:
#!/bin/bash
/path/to/program
/path/to/this/script
Anyway... Thanks again for everybody's help, and I hope that my membership will continue to be as enjoyable as this!

X-T
The bad thing about this alternate way is that bash instances will pile up. Each time you call the script a new bash session is opened, and they will live forever, filling your ram.

That's not a problem if it crashes a couple of time, but it's a big problem if it happens a few dozen times. So, I'd use the while loop instead.
 
Old 09-22-2008, 09:19 AM   #7
xtothat
Member
 
Registered: Sep 2008
Location: Middle of Nowhere, England
Distribution: Slackware 14.1, Ubuntu 13.10
Posts: 39

Original Poster
Rep: Reputation: 15
I'm learning something new every post. I'll go with the while loop. Thanks!!!
 
Old 09-22-2008, 10:06 AM   #8
piete
Member
 
Registered: Apr 2005
Location: Havant, Hampshire, UK
Distribution: Slamd64, Slackware, PS2Linux
Posts: 465

Rep: Reputation: 44
Code:
#!/bin/bash
/path/to/program
exec /path/to/this/script
Should keep the number of instances down to exactly one, since instead of spawning a new instance, it'll just reuse the same one (or more accurately, replace whatever spawned it) ...

I hope
 
Old 09-23-2008, 05:20 AM   #9
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,029

Rep: Reputation: 368Reputation: 368Reputation: 368Reputation: 368
Quote:
Originally Posted by piete View Post
Code:
#!/bin/bash
/path/to/program
exec /path/to/this/script
Should keep the number of instances down to exactly one, since instead of spawning a new instance, it'll just reuse the same one (or more accurately, replace whatever spawned it) ...

I hope
Yes, that's correct as well.
 
Old 09-26-2008, 12:56 PM   #10
xtothat
Member
 
Registered: Sep 2008
Location: Middle of Nowhere, England
Distribution: Slackware 14.1, Ubuntu 13.10
Posts: 39

Original Poster
Rep: Reputation: 15
Cool! Thanks!
 
  


Reply

Tags
bash, kde


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Configuring a program or script to run when KDE (or X) is started dizzi Slackware 2 05-31-2007 12:46 PM
Plz help me in permanently resizing windows in KDE tdunne Linux - Software 5 08-24-2006 03:44 PM
Run program before KDE startup carl.waldbieser Linux - Software 8 06-30-2006 08:15 PM
KDE g++ program doesn't run test.cpp richikiki Programming 6 03-17-2006 02:47 PM
KDE annoyance: how to get rid of kgpg from the system tray permanently? vharishankar Linux - Software 7 07-25-2005 11:26 PM


All times are GMT -5. The time now is 04:07 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration