Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 08-18-2002, 04:26 PM   #1
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, 05:26 PM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
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)
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, 05:27 PM   #3
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 &


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 02:04 PM
How do I run a PHP script as a service? robbiemorgan Linux - Newbie 3 04-13-2005 03:03 PM
run perl service on Linuxstartup shahidawan Programming 2 03-30-2005 12:57 PM
run app as service MiniBubba Mandriva 3 09-19-2004 08:51 AM
Getting mysql4 to run as a Service jerry_redhat Linux - Software 1 07-27-2003 05:17 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:00 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration