LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-18-2002, 03:26 PM   #1
tisource
Member
 
Registered: Feb 2002
Posts: 322

Rep: Reputation: 30
Run as Service...


This may be a stupid question, but I was just wondering if this is possible:

I know that running a program as a "service" is much different in windows than in linux. As far as I know (which is very little), linux doesn't see programs as a service. They're either running or they're not. Some programs run in the background and others run interactively for the user.

I have a Mandrake 8.2 web/database/file server that is handling the company's web site. I have a program that needs to run as a service. I want to set it up so I can control it from the command line like "service progname start" and it will run in the background. It doesn't need to be run all the time, and only needs running when we need it.

I know I can do "service dhcpd start" and the dhcp daemon will start. That's what I want to do with this program. If I'm not mistaken, there is a file somewhere and you just put a start {} and stop {} section in....?? But I don't remember much. I'm not sure.

Any suggestions or ideas would be great. Thanks ahead of time.
 
Old 08-18-2002, 04:26 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
generally it's seldom worth going to all the effort of a service script, it's not really necessary...

load program in background:

progname &

stop program

kill (pidnumber)
or
killall programname

should be all you really need... BUT you can hack an existing script around to do that kind of thing for you, you've got plenty of example in /etc/init.d, and once you've customized one to suit you you should be able to run it like any other service
 
Old 08-18-2002, 04:27 PM   #3
turnip
Member
 
Registered: Jul 2002
Posts: 143

Rep: Reputation: 15
one thing to note there, starting the prog/service with nohup often helps with backrounding issues.

nohup ./progname &
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
FTP service in Run Level 3 spelltoronto Linux - Newbie 2 08-15-2005 01:04 PM
How do I run a PHP script as a service? robbiemorgan Linux - Newbie 3 04-13-2005 02:03 PM
run perl service on Linuxstartup shahidawan Programming 2 03-30-2005 11:57 AM
run app as service MiniBubba Mandriva 3 09-19-2004 07:51 AM
Getting mysql4 to run as a Service jerry_redhat Linux - Software 1 07-27-2003 04:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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