LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 12-22-2006, 03:03 PM   #1
andrewstr
Member
 
Registered: Oct 2003
Location: WA--USA
Distribution: Red Hat 9, Suse 10.2
Posts: 144

Rep: Reputation: 15
Persistant Program/Process


I want to start a script each time I boot my Suse 10.0 box. The script launches Icecast and mpg321 (which plays a local Icecast stream). Currently I'm using /etc/init.d/boot.local to accomplish this.

My problem is that if the stream drops out momentarily, mpg321 quits. What are my options for having mpg321 attempt to reconnect to the stream infinitely? Also, I want to ensure that Icecast is always running.

My first thought was to create a cron job that checks for these processes every minute but wasn't sure that was the best or easiest way to handle this.

Thanks,

Andy
 
Old 12-22-2006, 03:43 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
there a number of different ways you can run this through, about the most hardcore that could be justified is setting mpg321 as a shell for a dedicated user on one terminal, so when mpg321 quits, the login session ends and logs in again, pretty simple to do, but hopefully too drastic. a more rational solution would probably be to just turn the mpg321 command into an infinite loop where it already is:
Code:
while true; do mpg321 x y z; sleep 5; done
just put a small pause before it restarts to stop things potentially getting ugly.
 
Old 12-22-2006, 06:21 PM   #3
andrewstr
Member
 
Registered: Oct 2003
Location: WA--USA
Distribution: Red Hat 9, Suse 10.2
Posts: 144

Original Poster
Rep: Reputation: 15
Thank you! That did the trick. Should I do the same for icecast?
 
  


Reply



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
Get process info in C program imsandy_007 Programming 4 11-22-2006 07:48 AM
have to program to get process ID? George2 Programming 6 08-24-2006 03:07 AM
Starting a program with a given process id DropSig Linux - Newbie 1 09-29-2004 08:41 PM
Process monitor in program ... joda Linux - Networking 1 06-10-2004 01:22 PM
what is this program/process? BajaNick Linux - General 3 07-07-2003 01:05 PM

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

All times are GMT -5. The time now is 06:29 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