LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   start services at startup automatically (http://www.linuxquestions.org/questions/linux-newbie-8/start-services-at-startup-automatically-261367/)

merlin23 12-01-2004 11:35 AM

start services at startup automatically
 
Hello!

Could anyone explain me how i can configure services at startup?
I have an apache installed and want it to automatically start at the beginning.
I use Mandrake linux, but I have compiled the sources myself and now I don't
find them in the graphical configuration tool (where you can turn off/on the services) from mandrake.

So I start them always in the command line, but i couldn't find out how to make it start at boottime, maybe I have to put it in the init.d/ directory and link it to rc.d4/ (if I am in runlevel 4) ?

sigsegv 12-01-2004 11:54 AM

Re: start services at startup automatically
 
Quote:

Originally posted by merlin23

So I start them always in the command line, but i couldn't find out how to make it start at boottime, maybe I have to put it in the init.d/ directory and link it to rc.d4/ (if I am in runlevel 4) ?

Exactly right. :)

Installing from the distro's package might be a better option though, as that way you'll be able to track updates with the rest of the system.

michaelk 12-01-2004 12:02 PM

http://linux.about.com/library/cmd/b..._chkconfig.htm

The start/stop scripts are stored in init.d. When you add the service via chkconfig that will create a link in the approiate rc.d directory.

Or you can add a line in the rc.local file to start a service.

Captain Crash 12-01-2004 04:27 PM

i have a similar problem or maybe not
I'm kinda new to this so please bear with me
I'm running mandrake 9.1 on my PC
when i boot the network service or interface doesn't come up
However when i go into mandrake control center i can run drake connect and start the network interface which afterward it works.
i can tell by running /sbin/ifconfig from rxvt before and after i run drake connect
i dont have this problem on my laptop which is running the same distro.
can any body help me?

merlin23 12-02-2004 04:31 AM

I have the same problem, too... (though 1st priority is the problem above for me in meanwhile)..If I can figure anything out about it, I will come back and post it...
maybe some guru has some nice hints?

To the 1st problem from above:

How do I create such a start/stop script for my etc/init.d ?
Do I just have to write into a file the command "/usr/local/apache/bin/apachectl start" and make it executable??


merlin23 12-15-2004 07:43 AM

I've recognized that after bringing up the networkcard with drake, it now seems to start up automatically everytime I reboot...

What me makes worry is this httpd daemon...
Because I compiled it by source, I don't know how to do this with drake...

so maybe somebody could give me a hint to my question from above ?




Quote:

How do I create such a start/stop script for my etc/init.d ?
Do I just have to write into a file the command "/usr/local/apache/bin/apachectl start" and make it executable??
Is it a normal shell-script I need to write??

EDIT:
Ok, I reread the thread...I think I will give it a try and append it to my /etc/rc.d/rc.local script to the end:

/usr/local/bin/apachectl start

hope this will work, the next reboot will be tomorrow...anyway, I 'd be very interested how this works with the runlevel-dircetories...

Write shell-script to /etc/init.d and then link it to rc5.d (for runlevel 5) , is this correct so??

houdelou 01-26-2005 07:10 AM

you probably have already a script to start apache on your computer. Look in /etc/rc.d/rc.httpd. If this script exists, just change the permissions so that it can be read and executed. chmod 755 /etc/rc.d/rc.httpd. If it does not exist on your computer, try to find one on apache web page or elsewhere on the internet.

merlin23 01-28-2005 07:03 AM

thx a lot, I'll give it a try soon...

nethertheless, the way described before worked very well, I just have appended the command "apachectl start" to the rc.local ... ;)

What I suggest is now, that I could simple create a file rc.httpd and put that command into it ?
Would this work also?


houdelou 01-28-2005 02:09 PM

yes, anything you put in /etc/rc.d starting with rc. is run at startup. The file has to be executable also. Here is the content of script that was installed by default in my /etc/rc.d/rc.httpd


#!/bin/sh
#
# /etc/rc.d/rc.httpd
#
# Start/stop/restart the Apache web server.
#
# To make Apache start automatically at boot, make this
# file executable: chmod 755 /etc/rc.d/rc.httpd
#

case "$1" in
'start')
/usr/sbin/apachectl start ;;
'stop')
/usr/sbin/apachectl stop ;;
'restart')
/usr/sbin/apachectl restart ;;
*)
echo "usage $0 start|stop|restart" ;;
esac


As you can see, it is very alike but with a little more options. (restart is very useful).

CodeFreaker 06-30-2013 02:52 AM

Quote:

Originally Posted by merlin23 (Post 1324775)
Hello!

Could anyone explain me how i can configure services at startup?
I have an apache installed and want it to automatically start at the beginning.
I use Mandrake linux, but I have compiled the sources myself and now I don't
find them in the graphical configuration tool (where you can turn off/on the services) from mandrake.

So I start them always in the command line, but i couldn't find out how to make it start at boottime, maybe I have to put it in the init.d/ directory and link it to rc.d4/ (if I am in runlevel 4) ?

You can use chkconfig command in redhat.

eg:
chkconfig --level 35 sshd on

--level you can define which level the service should run at start up.This it runs at 3 and 5.run chkconfig you can see the list of services and run level configured at startup.

chrism01 06-30-2013 04:48 AM

You know this thread was from 2004/2005?


All times are GMT -5. The time now is 01:02 PM.