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:
Printable View
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:
You need to clarify. Are you writing the service itself, or do you already have the service but cannot make it run?
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)
The one I know of is starting a process with an ampersand that makes it run in the back ground like /home/et/etded &
:D
Are you running an Enemy Territory server?
I'm already running 12 ET servers, however I'm also running FEAR servers and CS:S.
That was just an example
Services (daemons) are normally written especially. Normal apps generally aren't suitable for that task.
I'll just keep using sh /path/start.sh then =/
Thanks
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 :
Then run the following command (again using apache as the example script name):Code:#!/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
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
Thanks, that helped a bunch! :thumb:
No problem :)