LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-18-2005, 07:28 PM   #1
JonathonReinhart
Member
 
Registered: Nov 2005
Location: Ohio
Distribution: SuSE
Posts: 34

Rep: Reputation: 15
Question Running a .pl script as a sevice


Hello everyone, this should be a challenge I think. I'm running SuSE 9.1 . I have a perl script that runs a proxy server designed for mobile web use. I would like to have an /etc/init.d/ script that controls this. I want it to have the standard start, stop, restart, and status command, just like the scripts used for dhcpd, network, smbd, etc. However, I don't want the script to return running just beacuse the script file started, I want it to wait until the proxy server is actually running. I'm assuming I'll need to put something in my perl script that says something like, ok I'm acually running now.

This has been very difficult for me. I've tried working with the /etc/init.d/skeleton file as a basis, but all the existing /etc/init.d scripts are calling executable binary files, where mine is a perl script. The existing scripts use startproc. I looked in the man page for startproc, and under bugs, it says something about not being able to start things thru scripts. It cannot do this because it looks for the script's inode in the running process list, when you are actually looking for whatever is in the script to be running.

I really appreciate anything anyone can help me with. And If you need more information, please ask. It's hard to explain every single detail.

Thanks !
 
Old 11-19-2005, 12:02 AM   #2
YetAnotherDave
Member
 
Registered: Feb 2005
Posts: 95

Rep: Reputation: 17
Hi Jonathon,

Although this does not directly answer your question, you might find it useful.

A family of programs collectively called "runit" is designed to start, stop and monitor services. I use runit to start scripts running at boot time. Using runit is *much* simpler than writing init.d style init scripts ( based on first hand experience ).

Hope this helps.

Here's the link: http://smarden.org/runit/index.html .

- Dave
 
Old 11-21-2005, 08:03 PM   #3
JonathonReinhart
Member
 
Registered: Nov 2005
Location: Ohio
Distribution: SuSE
Posts: 34

Original Poster
Rep: Reputation: 15
Hmm, there are links to quite a few interesting pages, but nothing seems to help. I think maybe I know why I cannot figure this out - I may be asking for the wrong information.

Perhaps what I really need to know is how to pass information from a running perl script to the script that called it. For expample, when the perl script is called, it may take about 2-3 seconds before it is actually running, and doing its job. It is then that it should tell the script that called it (sysvinit?) that it is Running .

And how do I go about stopping this? This also comes into play with the /etc/init.d/ script. I need to look in the list of running processes, but for what? Am I killing Perl, or am I killing my script?

It is the interaction between the /etc/init.d/ script, and the daemons (my perl script) that I need to know about. I'm assuming I'll have to implement more code into the perl script.

Thanks!

Last edited by JonathonReinhart; 11-21-2005 at 08:04 PM.
 
  


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
Running a script spacemonk Linux - Newbie 4 07-30-2004 04:02 AM
Running script in background skguha Linux - Newbie 7 04-02-2004 08:32 AM
Running script as daemon StinkyFinger Linux - Newbie 2 08-28-2003 07:31 PM
running script at boottime Ratclaws Linux - General 2 10-24-2001 06:05 PM
no result from running script cowardnewbie Programming 1 09-09-2001 07:26 PM

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

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