LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 12-30-2007, 09:57 AM   #1
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Rep: Reputation: 57
[ $(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
 
Old 12-30-2007, 10:13 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
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.
 
Old 12-30-2007, 11:03 AM   #3
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 57
Quote:
Originally Posted by acid_kewpie View Post
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 ?
 
Old 12-30-2007, 11:49 AM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
Also have a look at pgrep.
 
Old 12-30-2007, 12:09 PM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
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.
 
Old 12-30-2007, 02:38 PM   #6
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 57
Quote:
Originally Posted by acid_kewpie View Post
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 ?

Code:
killall -e skype
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 02:40 PM.
 
Old 12-30-2007, 03:55 PM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
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.
 
Old 12-30-2007, 06:23 PM   #8
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 57
Wink

Quote:
Originally Posted by acid_kewpie View Post
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 06:24 PM.
 
  


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
zsnes && logitech dual action gamepad && dpad woes John5788 Linux - Games 5 10-29-2008 10:56 PM
Installing & using google talk & skype & other Windows applicatiounder Xubuntu rakeshj Linux - Desktop 6 07-31-2007 02:40 PM
AOL UK && BT Voyager 100 && Slackware 10.2 && RP-PPPoE pitt0071 Linux - Networking 3 01-17-2006 07:10 AM
Japanese canna won't work : Warning: かな漢字変&am OrganicOrange84 Debian 3 06-30-2005 03:28 PM
Phục hồi dữ liệu bị mất???, cứ pollsite General 1 06-27-2005 01:39 PM


All times are GMT -5. The time now is 12:50 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration