Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
12-30-2007, 08:57 AM
|
#1
|
Senior Member
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561
Rep:
|
[ $(skypnotrunning) ] && skype & how?
Hi !
Skype crashes time to time due to the webcam.
Is there a way to check the ps -aux if it is running on my X :0, and restart it when it crashed.
Would have someone bash/CODE to propose ?
thnaks a lot, thats very newby question level
|
|
|
12-30-2007, 09:13 AM
|
#2
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
assuming that skype (which i've never used, so don't know the behaviour or the binary name...) doesn't fork or have a more complex run logic, just use the fact that it's running to hold a loop...
Code:
while [ 1 ]
do
skype
sleep 3 # could go nuts maybe, worth hanging up for a few seconds
done
use that script as a launcher in X and it'll always respawn automatically.
|
|
|
12-30-2007, 10:03 AM
|
#3
|
Senior Member
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561
Original Poster
Rep:
|
Quote:
Originally Posted by acid_kewpie
assuming that skype (which i've never used, so don't know the behaviour or the binary name...) doesn't fork or have a more complex run logic, just use the fact that it's running to hold a loop...
Code:
while [ 1 ]
do
skype
sleep 3 # could go nuts maybe, worth hanging up for a few seconds
done
use that script as a launcher in X and it'll always respawn automatically.
|
the thing is that [ 1 ]
should maybe be replaced by
"$(ps -aux | grep skype )" == "skype"
no ?
|
|
|
12-30-2007, 10:49 AM
|
#4
|
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530
Rep:
|
Also have a look at pgrep.
|
|
|
12-30-2007, 11:09 AM
|
#5
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
no?
no.... if skype crashes then the loop just starts again. there's no need to check if skype itself is running at all, that's the point of the infinite loop, just keep reloading it each time.
you could use pidof or something, but i think you're in danger of overengineering an otherwise very simple scenario.
|
|
|
12-30-2007, 01:38 PM
|
#6
|
Senior Member
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561
Original Poster
Rep:
|
Quote:
Originally Posted by acid_kewpie
no?
no.... if skype crashes then the loop just starts again. there's no need to check if skype itself is running at all, that's the point of the infinite loop, just keep reloading it each time.
you could use pidof or something, but i think you're in danger of overengineering an otherwise very simple scenario.
|
yes
Ah, yes, it is indeed a nice idea, you got. I'd have the following question: how can I close it, when I log in the machine with ssh ?
will obviouly not work
maybe:
Code:
# echo "while [ 1 ] ; do skype ; sleep 10 ; done" > /usr/bin/skypenocrash
# chmod +x /usr/bin/skypenocrash
then
Code:
$ skypenocrash &
$ killall -e skypenocrash
may work, no ?
I don't know whether it is the best solution. What would you think ?
Thanks !
--------------------
Last edited by frenchn00b; 12-30-2007 at 01:40 PM.
|
|
|
12-30-2007, 02:55 PM
|
#7
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
well if all you want is to literally kill it, close the controlling terminal of ctrl+c it. there is going to be a bash instances which it running skype obviously, so you could easily get the parent process and kill that instance.
|
|
|
12-30-2007, 05:23 PM
|
#8
|
Senior Member
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561
Original Poster
Rep:
|
Quote:
Originally Posted by acid_kewpie
well if all you want is to literally kill it, close the controlling terminal of ctrl+c it. there is going to be a bash instances which it running skype obviously, so you could easily get the parent process and kill that instance.
|
well, that might not be possible since it starts with the fluxbox startup, and I would have only ssh access. no ctrl c. only some kill way...
Good evening & Regards
Last edited by frenchn00b; 12-30-2007 at 05:24 PM.
|
|
|
All times are GMT -5. The time now is 11:56 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|