LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Running a service at startup (https://www.linuxquestions.org/questions/linux-general-1/running-a-service-at-startup-45749/)

correro 02-17-2003 01:51 AM

Running a service at startup
 
I want a service to run at startup.

Since I'm new in Linux, please give me detailed instructions.

Thanks!

MasterC 02-17-2003 02:01 AM

Wow, it really doesn't get more vague than that ;) A generalized answer would be to suggest putting it into your rc.local file, usually in /etc

However, if you give us some details we might be able to help a bit more. What distro? What service?

Cool

correro 02-17-2003 02:10 AM

lets say, i installed alpha in /usr/local, and the command script is /usr/local/alpha/bin/alpha.sh

what i do now is run alpha.sh start manually every time i reboot the machine.

so what should i do about it, masterc?

Thanks for your help!
/usr/local

MasterC 02-17-2003 02:16 AM

Place /usr/loca/alpha/bin/alpha.sh in your /etc/rc.local file (again, this depends on your distro, but for the most part your distro should have this file).

So using your favorite text editor open up your rc.local file, and place this line in there:
/usr/loca/alpha/bin/alpha.sh

Then save and exit, and you are done.

Cool

correro 02-17-2003 02:31 AM

I tried appending /usr/local/alpha/bin/alpha.sh to [B]/etc/rc.d/rc.local[B], but it does not seem to be working.

How do I check if something is running or not?

My system is Red Hat 7.1, incidentally.

What should I do next?

keevitaja 02-17-2003 02:34 AM

do
ps -axu | grep alpha.sh

if it is not there then try

/sbin/chkconfig /usr/local/alpha/bin/alpha.sh --level 345 on

but i am not sure, if this command works with user defined services. and you must reboot.

correro 02-17-2003 02:40 AM

how do i use chkconfig to add it to startup?

i know the syntax is
chkconfig --add <name>

but i guess i should do something before running
chkconfig --add alhpa

is that correct?

keevitaja 02-17-2003 02:49 AM

i think the questin is how will chkconfig know where is that alpha you are trying to run... never used it like that. only services which are located in /etc/init.d

acid_kewpie 02-17-2003 02:51 AM

chkconfig can only be used with proper daemon control services, not general applications. if running "/usr/local/alpha/bin/alpha.sh" works on a command line then it MUST work running it in rc.local, just remember to add a & to the end to make sure it forks.

correro 02-17-2003 03:09 AM

this looks very strange to me.

alpha is started when system initiates, i can locate it in processes, but it is not working properly.

actually, "alpha" is a web server. i added
/usr/local/alpha/bin/alpha.sh start &
to /etc/rc.d/rc.local, rebooted the machine, but alpha is not serving as it is expected to. i ran ps -axu, and found it among the process

what do you guys think is the issue?

newbie correro

MasterC 02-17-2003 03:00 PM

Maybe who it is run as?

correro 02-17-2003 07:01 PM

what does that mean, masterc?
do i need to specify who runs it? if so, how?

MasterC 02-17-2003 07:04 PM

When you run ps -aux who does it say the process is running as? When you run the process by hand after the install (assuming it's not in rc.local) what user do you run it as?

Cool

correro 02-17-2003 07:21 PM

if "ps -aux | grep alpha" does not return a line about alpha, does it mean alpha is not started at all?
that is the case now, though i have added "/usr/local/alpha/bin/alpha.sh start &" to /etc/rc.d/rc.local
what do you think i should do?

menhilmor 02-18-2003 07:00 PM

.
 
I would start alpha like normal from a command line, see if I can find what it looks like using ps, and then try to find that same info using ps after I try rebooting with alpha.sh in rc.local. That's the vague answer to a vague alpha.sh.

I would wonder why rc.local isn't kicking stuff off the way it should. Maybe you could try putting other scripts in there to see if alpha.sh has problems or if rc.local has problems? Maybe just an echo "HI I'M IN RC.LOCAL" for you to watch for during boot?

I'm new to Linux too, this is just stuff I would look for.


All times are GMT -5. The time now is 05:48 AM.