Proper way to add a service?

0

I've just installed and config'ed noip on my server, but I'm unsure on how to make it always run.

I'm guessing:

chkconfig --levels 235 noip on
/etc/init.d/noip start

I've checked /etc/init.d/ and there is a noip file there... Sorry for a newb question, but I don't want to mess up my configuration. :-)

Also, could anyone explain the --levels 235 argument? I'm really fresh, but I understand there are certain runlevels?

Jason94

Posted 2011-06-09T05:56:19.630

Reputation: 1 125

You're on the right track. A simple Web search turns up what you are after: http://en.wikipedia.org/wiki/Runlevel man chkconfig will also help

– Linker3000 – 2011-06-09T06:01:31.903

when i do chkconfig --levels 235 noip on it will start that service every time i enter the runlevelse 2, 3, 5? and /etc/init.d/noip start will start it now? – Jason94 – 2011-06-09T06:05:36.160

Answers

2

Did you install noip through yum? The yum RPM package should install the noip service script in /etc/init.d/ for you. Run the following commands as root to install and setup noip through yum.

yum install noip

noip2 -C

service noip start

To configure the noip service to automatically run at startup, run the following command as root.

ntsysv

If you really want to know the nitty gritty details of adding a service, here's a good tutorial on manually adding a service.

http://www.thelinuxblog.com/adding-a-service-on-fedora/

To answer your second question, the --levels parameter tells which run levels a an operation should run in. Linux has seven run levels by default. Each run level can start different set of services. For example, Runlevel 1 will put the system into Single User Mode, which only starts most basic services and puts you into a root shell. Runlevel 3 is multi-user mode with no GUI. Runlevel 5 is similar to Runlevel 3 except it also includes the (GUI). Runlevel 6 is another special mode that will reboot the system. More detail about run levels can be found at Wikipedia

Adam Prax

Posted 2011-06-09T05:56:19.630

Reputation: 921

Note, I'm using fedora17, and the ntsysv is no longer supported. Instead I used systemctl enable noip.service. I had no idea yum would be so useful.

That aside, I just spent hours fiddling, installing, uninstalling, and rebooting trying to do what you so simply outlined in this answer. Thank you. – danielpiestrak – 2012-09-03T14:48:36.797