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! |
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 |
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 |
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 |
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? |
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. |
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? |
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
|
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.
|
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 |
Maybe who it is run as?
|
what does that mean, masterc?
do i need to specify who runs it? if so, how? |
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 |
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? |
.
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 02:15 PM. |