PDA

Click to See Complete Forum and Search --> : [RESOLVED] Fedora Core 5 Services


RudiVisser
Apr 8th, 2007, 10:18 AM
Okay, so, my server's got FD5 on it, and, I need to make a service to run on it.

ie. service NAME start

I know you can replicate this with shell scripts, but actual services.. help? :)

Thanks ! :wave:

wossname
Apr 8th, 2007, 02:49 PM
You need to clarify. Are you writing the service itself, or do you already have the service but cannot make it run?

RudiVisser
Apr 8th, 2007, 03:35 PM
I basically want a normal application to run as a service.

ie. I have an executable (etded), that can be run from, for example, /home/et/etded

Is it possible to just make it into a service as to have start stop status commands? Or does that need to be done in a more in-depth way? (Probably the latter)

litlewiki
Apr 8th, 2007, 04:48 PM
The one I know of is starting a process with an ampersand that makes it run in the back ground like /home/et/etded &

grilkip
Apr 9th, 2007, 03:22 AM
:D

Are you running an Enemy Territory server?

RudiVisser
Apr 9th, 2007, 06:29 AM
I'm already running 12 ET servers, however I'm also running FEAR servers and CS:S.

That was just an example

wossname
Apr 9th, 2007, 07:01 AM
Services (daemons) are normally written especially. Normal apps generally aren't suitable for that task.

RudiVisser
Apr 9th, 2007, 07:14 AM
I'll just keep using sh /path/start.sh then =/

Thanks

CyberSurfer
Apr 10th, 2007, 08:16 AM
Instead of writing a service, you can use an init.d script to do what you want...Basically, an init.d script is a startup script that runs whenever your system boots up. To create one, use the following steps:

First of all, create a file in /etc/init.d called whatever you want the name of the service to be, for example apache...then in that file, put something like the following :


#!/bin/sh
case $1 in
'start' )
#Startup command for your app
/this/is/an/example/command.sh
;;
'stop' )
#nameofyourapp should be changed to match whatever name your app is listed under when running.
ps -ef | grep nameofyourapp | awk '{print $2}' | xargs kill -9
;;
*)
echo "usage: `basename $0` {start|stop}"
esac


Then run the following command (again using apache as the example script name):

chkconfig --add apache

This will then set the script to be started whenever your system starts.

Additionally, you can now start and stop your app by using the following commands, again assuming apache was the name of your script:

To start:
/etc/init.d/apache start

To stop:
/etc/init.d/apache stop

RudiVisser
Apr 10th, 2007, 08:21 AM
Thanks, that helped a bunch! :thumb:

CyberSurfer
Apr 10th, 2007, 08:22 AM
No problem :)